Question: Questions about Java interface and abstract Question1 Which of the following statements tests for CONTENT equality? if ( x == Hello ) { ... }
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" ) ) { ... } |
| None of the above |
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 );
| p1.getX() > p2.getX() |
| p1.setX(5) == p2.setX(5) |
| p1 < p2 |
| all of the above |
| 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){ ...} |
| return new Boo(); |
| if ( myThing == b ) { ... } |
| private Boo myThing; |
| Boo Hoo |
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) |
| All of the above. |
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. |
| All of the above. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
