| Credit weighting: | 5 credit module |
|---|---|
| Prerequisites: | CS1117 |
| Lectures: | 2 × 1 hr per week |
| Labs: | 1 × 2 hr per week |
| Private study: | At least 2 hrs per week |
| Examination: | 1.5 hr written exam (80% of the marks) |
|---|---|
| Continuous assessment: | Programs (20% of the marks) |
| How to fail: | Skip lectures & labs; avoid private study; cram at Easter; expect the exam to be a memory test |
|---|---|
| How to pass: | Attend lectures & labs; summarize the notes; tackle the lab activities properly; expect a problem-solving exam |
| Java 1 | 1996 | JDK 1.0 | 250 classes |
| 1997 | JDK 1.1 | 500 classes | |
| Java 2 | 1998 | J2SE 1.2 | 2300 classes |
| 2000 | J2SE 1.3 | ||
| 2002 | J2SE 1.4 | ||
| Java 5 | 2004 | J2SE 5.0 (internally 1.5) | 3500 classes |
| Java 6 | 2006 | Java SE 6 (internally 1.6) | |
| Java 7 | 2011 | Java SE 7 (internally 1.7) | |
| Java 8 | 2014 | Java SE 8 (internally 1.8) | |
| Java 9 | September 2016? | ||
java.lang.System.outSystem.outprintln for printing some data and a new line characterprint for printing some data (and remaining on the same line)System.out.println("Hello world!");
Store this in HelloWorld.java:
class HelloWorld {
public static void main(String[] args) {
// For now, all your code goes here
}
}
You re-compile for machines with different instruction sets
A Java slogan is: write once, run anywhere
java.lang.System.inSystem.inread for reading one bytenewsc:
java.util.Scanner sc = new java.util.Scanner(System.in);
sc has several functions (methods) including:
nextInt for reading an integernextDouble for reading a floating-point numbernextLine for reading a StringWrite a program that asks the user for his/her name and prints it out again, e.g.:
Halt! Who goes there? Ann
Hello, Ann. You may pass.
(User's input is shown in red.)