C1022 Introduction to Java Term 1 2008 assignment
Hi! ![]()
This time I will post the assignment that I get for C1022 Introduction to Java module in Term 1 2008.
SECTION A
A1. Write Java statements to accomplish each of the following:
a) Declare a variable ‘reply’ to be of type char.
char reply;
b) To compare the contents of both variables ‘pass’ and ‘word’ of type String.
pass.compareTo (word) > 0;
pass.compareTo (word) == 0;
pass.compareTo (word) < 0;
pass.compareTo (word) > 0;
pass.equals (word);
pass.equalsIgnoreCase (word);
c) To assign a float value 2.5 to a variable ‘number.
float number = 2.5f;
d) Display a message ‘happy new year’ using a method from the Systems class.


