Questions about Java interface and abstract
Question1
Which of the following statements tests for CONTENT equality?
| if ( x == "Hello" ) { ... } |
| if ( x.equals( "Hello" ) ) { ... } |
| if ( x != "Hello" ) { ... } |
| if ( x.contains( "Hello" ) ) { ... } |
Flag this Question
Question 2
Which comparison below is acceptable in Java syntax if the following declarations are made? CSC142Point p1 = new CSC142Point( 3, 4 ); CSC142Point p2 = new CSC142Point( 5, 6 );
| none of the first 3 are acceptable syntax in Java |
Flag this Question
Question 3
Which of the following statements creates a composition (or aggregation) relationship?
| public doSomething(Boo b){ ...} |
| if ( myThing == b ) { ... } |
Flag this Question
Question 4
Which of the following things may an abstract class contain in addition to abstract methods?
| method definitions with implementations |
| instance variable declarations |
| constructor definitions with implementations |
| class constants (final variables) |
Flag this Question
Question 5
What is the difference between an abstract class and a concrete class?
| An abstract class may NOT be extended. |
| An abstract class may NOT be instantiated. |
| All methods in an abstract class must be abstract. |
| A reference variable cannot have an abstract class as its static type. |