Java Questions
Java Questions
(http://docs.oracle.com/javase/tutorial/java/javaOO/index.html)
VARIABLES QUESTIONS
Exercises
OPERATORS
Questions
1. Consider the following code snippet.
int i = 10;
int n = i++%5;
Exercises
Questions
Exercises
• aValue = 8933.234;
• aValue++;
• System.out.println("Hello World!");
• Bicycle myBike = new Bicycle();
Questions
Exercises
CLASSES QUESTIONS
Questions
Hint:
You can use the assert statement to check your assignments.
You write:
assert (boolean expression to test);
If the boolean expression is false, you will get an error message.
For example,
assert toString(ACE) == "Ace";
should return true, so there will be no error message.
If you use the assert statement, you must run your program with
the ea flag:
java -ea YourProgram.class
· 3. Write a small program to test your deck and card classes. The
program can be as simple as creating a deck of cards and
displaying its cards.
INHERITANCES
Questions
Exercises
1. Write the implementations for the methods that you answered in
question 2.
NUMBERS
Questions
Exercises
STRING