Object-Oriented Development

Practice Questions

Computer Science › Object-Oriented Development

Questions
2
1

Consider the following C++ pseudocode:

Class Car {

const int wheels = 4;

float milesPerGallon;

string make;

string model;

}

Car sportscar = new Car;

What is the difference between the class car, and the object sportscar?

2

JAVA EXPLICIT TYPE CASTING

Consider the following JAVA code:

**public static void main(String[] args)**

**{**

**double number1 = 99.05;**

**int number2 = (int) number1;**

**System.out.println("number1 = " + number1);**

****System.out.println("number2 = " + number2);**

**}**

What would be the console output?

Return to subject