1. What are the reserved literals?
    null, true, false
  2. What are the reserved keywords not in use?
    const, goto
  3. What are the integer data types?
    int, long, byte, short
  4. What must identifiers start with?
    letter, $, _ or other connector
  5. What can identifiers NOT start with?
    a number
  6. What is the max length of a Java identifier?
    There is no limit
  7. Are Java identifiers case sensitive?
  8. What can a Java identifier contain after the first character?
    any combination of letters, currency characters, connecting characters, or numbers
  9. Legal or illegal identifier: .f
    illegal cannot start with a .
  10. Legal or illegal identifier: _$szygy
  11. Standard for naming Classes and Interfaces
    CamelCase (i.e. MyGreatJavaClass)
  12. Standard for naming Methods
    first letter lowercase, remainder CamelCase (i.e. myMethodActing)
  13. Standard for naming variables
    first letter lowercase, remainder CamelCase (i.e. myMethodActing)
  14. Standard for naming constants
    UPPERCASE with _ as a separator (i.e. MIN_HEIGHT)
  15. The name of a Java class file...
    must match the name of the public class if there is one
  16. A Java file with no public classes can have what type of name?
    It can have any legal name
  17. Class Access modifiers
    public, protected, private - default access has no modifier
  18. What are the nonaccess class modifiers?
    strictfp, final, abstract
  19. A subclass inheriting a member is exactly the same as...
    The subclass declaring the member itself
  20. How many public classes can be in a source file?
    Exactly one
  21. Where must the package statement be for classes in a package?
    On the first line, before any import statements
  22. Where must import statements go?
    Between the package statement and any class declarations
  23. Where must a class declaration go when there are no package or import statements?
    It must be the first line of a source file
  24. When can an abstract class be instantiated?
  25. What is the purpose of an abstract class?
    To be extended (subclassed)
  26. What does final mean when applied to a class?
    A final class can't be subclassed
  27. All interfaces are implicitly, what?
    public and abstract
  28. All variables defined in an interface must be what?
    public, static, and final (i.e. constants)
  29. Interface methods are 100% abstract
  30. What are the member access control levels?
    Public, Protected, default (if nothing specified), private
  31. What must a class be declared as, to have an abstract method?
    The class must be declared as abstract
  32. A method cannot be both Abstract and ...?
    Abstract and Final, Abstract and Private
  33. Synchronized method keyword means
    Method can only be accessed by one thread at a time
  34. "native" means
    That the method is implemented in platform-dependent code
  35. "native" can only be applied to what?
    methods - not classes or variables
  36. strictfp can modify
    a class or method declaration
  37. strictfp means
    enforce IEEE754 standard
  38. What are var-args?
    methods that take a variable number of arguments
  39. How is a var-arg declared?
    datatype followed by ... followed by the arg name
  40. Which is legal: var test(int ... x) or var test(int ...)
    var test(int ... x)
  41. How many var-args can be in a method?
  42. Where must the var-arg be in the parameter list?
    at the end
  43. What can't a constructor have?
    a return type
  44. How are constructors different from methods?
    Constructors don't have a return type

    • What are the eight primitive types?
    • char, boolean, short, double, float, byte, int, long
  45. a reference variable is used to
    refer to or access an object
  46. A byte datatype takes x bytes and y bits
    1 byte, 8 bits
  47. A short datatype takes x bytes and y bits
    2 bytes, 16 bits
  48. An int datatype takes x bytes and y bits
    4 bytes, 32 bits
  49. A long datatype takes x bytes and y bits
    8 bytes, 64 bits
  50. A float datatype takes x bytes and y bits
    4 bytes, 32 bits
  51. A double datatype takes x bytes and y bits
    8 bytes, 64 bits
  52. What is the range of byte, short, int, long?
    (-2) ^ (bits -1) to (2 ^ (bits -1))-1
  53. Instance variables are defined
    inside the class, but outside any method
  54. Which access levels can Instance variables use
    any of the 4 access levels
  55. What keyword can be used to resolve name collisions?
  56. Is the statement int [5] scores; legal? If not, why?
    No, cannot include the size of the array in the declaration
  57. What keyword tells Java to skip an instance variable when serializing?
  58. What other keyword can only be applied to instance variables?
  59. What keyword identifies a variable as shared by all instances of a class containing that variable?
  60. What things CAN be marked as static?
    methods, variables, initialization blocks, a class nested in another class but not within a method
  61. What things CAN'T be marked as static?
    Constructors, classes (unless nested), Interfaces, Method Local Inner Classes, Inner Class methods and instance variables, local variables
  62. Where CAN'T an enum be declared?
    Within a method

    • What are the escape characters?
    • Big Farms Need Red Tractors - \b backspace, \f formfeed, \n newline \r carriage return \t horizontal tab \' single quote \" double quote \\ backslash
Card Set
Java scjp 1.6 study deck