Programming Concept Chapter I Introduction to Java Programming
By the end of this lecture you should be able to: explain how the module is structured; prepare adequately for lectures, tutorials and practicals; explain how the module is assessed; explain the meaning of the word software; explain how Java programs are compiled and run; use an integrated development environment (IDE) to write, compile and run programs.
Unit Lectures : Ematchandirane Vasu St-Patrick’s college, London
MODULE FORMAT
2.5 HOUR LECTURE 1 HOUR TUTORIAL 1.5 HOURS COMPUTER LAB
Preparing for your lectures, tutorials and practicals
ASSESSMENT
Assignment (Coursework)-week 12 Portfolio 1-Week 4 Portfolio 2-Week 7 Portfolio 3-Week 10
public class Game { Car f1; f1.spin(); } The set of instructions that tells a computer what to do is called a program
public class Game { Car f1; f1.spin(); } Software is the name given to a single program or a set of programs.
Application software is the name given to useful programs that a user might need.
System software is the name given to special programs that help the computer to do its job.
public class Game { Car f1; f1.spin(); } Programming is the task of writing instructions for the computer
public class Game { Car f1; f1.spin(); } These instructions have to be written in a special programming language.
public class Game { Car f1; f1.spin(); } Examples include: C++, Visual Basic, Pascal, Java.
public class Game { Car f1; f1.spin(); } Examples include: C++, Visual Basic, Pascal, Java.
Compiling Programs
COMPILER if (words > MAX) { System.out.print(); } program (source) code machine code Programmer Program user
Java Programming
JAVA COMPILER if (words > MAX) {System.out.print(); } program code JVM Java byte code Java Programmer
Java Applications
A console application
A graphical application
A Java Applet running in a browser
A Java application running on a mobile phone
A Java application running on a smart phone
Your first program
public class Hello { public static void main(String[ ] args) { System.out.println("Hello world"); } }
public class Hello { public static void main(String[] args) { System.out.println("Hello world"); } Hello World
public class Hello { public static void main(String[] args) { System.out.println("Hello world"); } Hello World public class Hello { } public static void main(String[ ] args) { } System.out.println("Hello world");
public class Hello { public static void main(String[] args) { System.out.println("Hello world"); } Hello World public class Hello { } public Static void main(String[ ] args) { System.out.println("Hello world");
public class Hello { public static void main(String[] args) { System.out.println("Hello world"); } Hello World public class Hello { } public Static void main(String[ ] args) { System.out.println("Hello world");
public class Hello { public static void main(String[] args) { System.out.println("Hello world"); } Hello World public class Hello { } public Static void main(String[ ] args) { System.out.println("Hello world");
public class Hello { public static void main(String[] args) { System.out.println("Hello world"); } Hello World public class Hello { } public static void main(String[ ] args) { System.out.println("Hello world");
public class Hello { public static void main(String[] args) { System.out.println("Hello world"); } Hello World public class Hello { } public static void main(String[ ] args) { System.out.println("Hello world");
public class Hello { public static void main(String[] args) { System.out.println("Hello world"); } Hello World public class Hello { } public static void main(String[ ] args) { } System.out.println("Hello world");
public class Hello { public static void main(String[] args) { System.out.println("Hello world"); } Hello World public class Hello { } public static void main(String[ ] args) { } System.out.println("Hello world");
Integrated development environment (IDE)
Type your programs here
Use these icons to compile and run you program
Compiler errors reported here
Your files shown here
Compiling and Running Java from TextPad 46 TextPad Optional
Compiling and Running Java from JBuilder 47 JBuilder Optional
Compiling and Running Java from NetBeans 48 NetBean s Optional
A Programming Puzzle
CREATE data
DISPLAY data
CREATE data PUT value IN data DISPLAY data
CREATE data PUT value IN data DISPLAY data ADD value TO data
CREATE data PUT value IN data DISPLAY data ADD value TO data 3 x 6 = ?
CREATE data PUT value IN data DISPLAY data CREATE data ADD value TO data
CREATE data PUT value IN data DISPLAY data CREATE total ADD value TO data
CREATE data PUT value IN data DISPLAY data CREATE total ADD value TO data total
CREATE data PUT value IN data DISPLAY data CREATE total ADD value TO data total PUT value IN data
CREATE data PUT value IN data DISPLAY data CREATE total ADD value TO data total PUT 6 IN total
CREATE data PUT value IN data DISPLAY data CREATE total ADD value TO data PUT 6 IN total 6 total
CREATE data PUT value IN data DISPLAY data CREATE total ADD value TO data PUT 6 IN total 6 total ADD value TO data
CREATE data PUT value IN data DISPLAY data CREATE total ADD value TO data PUT 6 IN total 6 total ADD 6 TO total
CREATE data PUT value IN data DISPLAY data CREATE total ADD value TO data PUT 6 IN total 12 total ADD 6 TO total
CREATE data PUT value IN data DISPLAY data CREATE total ADD value TO data PUT 6 IN total 12 total ADD 6 TO total ADD value TO data
CREATE data PUT value IN data DISPLAY data CREATE total ADD value TO data PUT 6 IN total 12 total ADD 6 TO total
CREATE data PUT value IN data DISPLAY data CREATE total ADD value TO data PUT 6 IN total 18 total ADD 6 TO total
CREATE data PUT value IN data DISPLAY data CREATE total ADD value TO data PUT 6 IN total 18 total ADD 6 TO total DISPLAY data
CREATE data PUT value IN data DISPLAY data CREATE total ADD value TO data PUT 6 IN total 18 total ADD 6 TO total DISPLAY total
CREATE data PUT value IN data DISPLAY data CREATE total ADD value TO data PUT 6 IN total 18 total ADD 6 TO total DISPLAY total 18
CREATE total PUT 6 IN total ADD 6 TO total DISPLAY total
CREATE total PUT 6 IN total ADD 6 TO total DISPLAY total Create data
CREATE total PUT 6 IN total ADD 6 TO total DISPLAY total Input data
CREATE total PUT 6 IN total ADD 6 TO total DISPLAY total Process data
CREATE total PUT 6 IN total ADD 6 TO total DISPLAY total Output data
CREATE total PUT 6 IN total ADD 6 TO total DISPLAY total