Home > Articles

  • Print
  • + Share This
This chapter is from the book

Workshop

Q & A

  • Q. Do all arguments sent to a Java application have to be strings?

  • A. Java stores all arguments as strings when an application runs. When you want to use one of these arguments as an integer or some other nonstring type, you have to convert the value. You learn how to do this during Hour 11, “Describing What Your Object Is Like.”

    Q. Does the line of succession to the British throne run out at some point?

  • A. Under Parliamentary law that has been in place since 1701, the British monarch must be a Protestant descendant of Sophia of Hanover, a German princess who was the heiress to the crown when the law was passed.

    There are a finite number of people who are descendants of Sophia, so there’s always somebody last in the regal line. The British government lists only the first 38, so genealogists have attempted to fill out the rest of the list themselves.

    The last person in the line of succession is Karin Vogel, a German pain therapist in her thirties. She was 4,973rd in line as of 2011, genealogists determined after an exhaustive search that took years. So if all the people ahead of her drop out of the running (to, say, spend more time learning Java programming), Vogel takes over the mortgage on Buckingham Palace and becomes Her Majesty Karin the First.

    Vogel is Sophia’s great-great-great-great-great-great-great-great-granddaughter. She told the Wall Street Journal that becoming monarch would be “too stressful.”

    With the birth of Prince William and Princess Kate’s son, George, more officially known as His Royal Highness Prince George Alexander Louis of Cambridge, Vogel dropped to 4,974.

Quiz

Test your knowledge of the material covered in this hour by answering the following questions.

  1. Which type of Java program can be run by a mobile device?

    1. Apps

    2. Applications

    3. None

  2. What does JVM stand for?

    1. Journal of Vacation Marketing

    2. Jacksonville Veterans Memorial

    3. Java Virtual Machine

  3. If you get into a fight with someone over the way to send information to a Java application, what are you doing?

    1. Struggling over strings

    2. Arguing about arguments

    3. Feudin’ for functionality

Answers

  1. A. Apps run as part of a mobile device such as a phone or tablet, whereas applications are run almost everywhere else.

  2. A., B., or C. Trick question! The initials stand for all three things, though Java Virtual Machine is the one you need to remember for the next 20 hours.

  3. B. Applications receive information in the form of arguments. Can’t we all just get along?

Activities

If you’d like to apply your acumen to applications, the following activities are suggested:

  • Using the Root application as a guide, create a NewRoot application that can display the square root of 625.

  • Using the Root application as a guide, create a NewRoot application that can display the square root of a number submitted as an argument.

Solutions for the activities in this book are presented on the book’s website at www.java24hours.com.

  • + Share This
  • 🔖 Save To Your Account