IT 114: Introduction to Java
Answers to Class 29 Ungraded Quiz

  1. What do you call the section of the code in which a Java declaration is valid?
    scope
  2. What is the scope of a variable inside a method?
    from the line in which it was declared to the closing curly brace
    of the section in which it is defined
  3. What is the scope of a method within a class?
    the entire class
  4. Can a variable be static?
    yes
  5. Write the statement you would use to create a constant named days_in_week and give it the value 7.
    public static final int days_in_week = 7;
  6. Can you have more than one constructor for a class?
    yes
  7. What must be different to allow you to create two methods with the same name?
    their parameter list