click below
click below
Normal Size Small Size show me how
SCJP #1
Chapter 1
Question | Answer |
---|---|
What 3 things can legal Java identifiers start with? | underscore, letter, currency character |
Legal Java identifiers can contain... (4) | letter, underscore, currency character, number |
Java Identifiers are case sensitive. True/False | True |
Name two things a legal Java identifier cannot use? | 1) cannot start with a number 2) cannot use a Java keyword/reserved word |
In Java Coding Standards, a class or interface name should be... (3) | 1) first character uppercase 2) camelCase 3) should typically be a noun. |
In Java Coding Standards, a method name should be... (3) | 1) first character lowercase 2) camelCase 3) should typically be a noun-verb pair. |
In Java Coding Standards, a variable name should be... (3) | 1) first character lowercase 2) camelCase 3) should be a short meaningful noun. |
In Java Coding Standards, a constant should be... (4) | 1) static 2) final 3) upercase characters 4) underscore character separates words |
In JavaBeans standards, a setter method should be... (4) | 1) "set" followed by property name 2) public 3) takes argument whose type is same as the property 4) void return type |
In JavaBeans standards, a getter method should be... (4) | 1) "get" followed by property name 2) public 3) takes no argumentsos 4) return type matches property type. |
What are JavaBean Listener naming rules? (3) | 1) to register listener: lowercase "add", then listener type, then "Listener" 2) to remove a listener: lowercase "remove", then listener type, then the word "Listener" 3) the type of Listener (add or remove) must be paased to method as an argument |
Name Java access modifiers (3) | public, private, protected |
What are the Java access controls (4) | public, private, protected, default |
A class can have what access modifiers | public and default |
Class access means you can... (3) | 1) create an instance of the class 2) extend the class 3) access the accessable methods and variables in the class |
What non-access modifiers can a class have? (3) | final, abstract, strictfp |
What does it mean when a class or method is marked strictfp | Any method or method code in the class conforms to IEEE 754 standards for floating points (behavior is not platform specific) |
Final keyword means: (3) | 1) class cannot be subclassed 2) method cannot be overridden 3) variable cannot be assigned |
Abstract classes can never be: | instantiated |
Methods marked abstract end in: | a semi-colon |
If one method in a class is abstract: | the whole class must be marked abstract. |
If a class is abstract, it cannot be: | final |
If a class is final, it cannot be: | abstract |
An interface is a contract. True/False | True |
An interface is a 100% _____ class. | abstract |
Interfaces can be implemented by... | any class from any inheritance tree. |
Interfaces are implicitly: | public and abstract, whether declared or not. |
Interface variables must be declared as: (3) | public, static, final |
Interface modifiers cannot be: (4) | static, final, strictfp, native |
Interfaces can extend: | 1 or more interfaces. |
Interfaces cannot extend | anything other than an interface. |
Interfaces cannot implement | another interface or class. |
An interface declaration must contain | the keyword "interface" |
Interface types cannot be used polymorphically. True/False | False |