Advanced Programming in Java Hello World In Java
- Slides: 22
Advanced Programming in Java “Hello World” In Java Mehdi Einali 1
Agenda Review First program in java Variables Methods Conditions Loops 2
Review Java is Simple object oriented And popular Java is platform independent. Write Once, Run Anywhere! 3
First Program in java 4
Hello World Create a file named First. java Java class files have. java extension Note to naming convention Copy this lines to the file Note: File name and class name should be the same. 5
6
Debugging Syntax Error Run-time errors exceptions logic or semantic error The semantics, or meaning of the program, are wrong 7
Java Programs A simple java program is a file The file contains one class The class name equal to the file name The names are case sensitive The class contains a main method When we run the program, the main method is executed 8
Variables What is a variable? A piece of memory Holds data For example a number, string or Boolean Java variables have a fixed size Platform independence 9
Java Primitive Types 10
Arithmetic Operators 11
Operator Precedence 1+2*3=? is treated as 1 + (2 * 3) 12
Equality and Relational Operators 13
Operators 14
Exercise 15
Programming strategy 16
Programming strategy Incremental Development Start with a working program that does something visible, like printing something. Add a small number of lines of code at a time, and test the program after every change. Repeat until the program does what it is supposed to do 17
Recipe For Failure -1 Non-incremental development If you write more than a few lines of code without compiling and testing, you are asking for trouble Attachment to bad code If you write more than a few lines of code without compiling and testing, you may not be able to debug it 18
Recipe For Failure -2 Random-walk programming Make a change, run the program, get an error, make a change, run the program, etc The problem is that there is no apparent connection between the outcome of the program and the change. Compiler submission Error messages are useful, but they are not always right. Please think before edit 19
Khokhan-1 20
Khokhan-2 Stubborn Crazy Untidy Stochastic Hate other khokhans And Love Chaos 21
end 22
- Formal greeting and responses
- The greetings song
- Hello my name is mary
- Advanced programming in java
- Java applet hello world
- Hello my friend friend of a friend
- Hello everyone hope you all are doing well
- Birchfield nursery
- Hello the sun is shining
- Hello good evening hi
- Small head fat body
- Hello hello to everyone it's english time
- Hello hello 1 2 3
- I'm muzzy big muzzy
- Hello pt
- Hello hello peter pan
- Dynamic programming bottom up
- Advanced internet programming
- What is imperative statement in assembly language
- Imperative statement in system programming
- Perbedaan linear programming dan integer programming
- Greedy programming vs dynamic programming
- System programming