Presentation is loading. Please wait.

Presentation is loading. Please wait.

“Introduction to Programming With Java”

Similar presentations

Presentation on theme: "“Introduction to Programming With Java”"— Presentation transcript:

1 nlp-ai@cse.iitb “Introduction to Programming With Java”

2 nlp-ai@cse.iitb Structure of Java programs Input and output to screen with Java program Statements Conditional statements Loop constructs Arrays, character and string handling Functions (if time permits)

3 nlp-ai@cse.iitb 1.Java 2: The Complete Reference – Patrick Naughton, Herbert Schildt 2.Thinking in Java ( – Bruce Eckel 3. Richard G Baldwin’s “Introductory Java Programming Tutorial” on:

4 nlp-ai@cse.iitb Structure of Java programs Compiling and running the program Printing messages to the screen

5 nlp-ai@cse.iitb Q. What is a program? Ans. A sequence of instructions that a computer can interpret and execute. Q. Why Java and not Hindi / Marathi / English? Ans. Since, so far, computer is not intelligent enough to understand natural languages.

6 nlp-ai@cse.iitb class class-name { public static void main(String args[]) { statement1; statement2; … }

7 nlp-ai@cse.iitb “” class First { public static void main(String args[]) { System.out.println(“Hello World”); }

8 nlp-ai@cse.iitb Compiling: is the process of translating source code written in a particular programming language into computer-readable machine code that can be executed. $ javac This command will produce a file ‘First.class’, which is used for running the program with the command ‘java’. Running: is the process of executing program on a computer. $ java First

9 nlp-ai@cse.iitb 1.System.out.println(“Hello World”); – outputs the string “Hello World” followed by a new line on the screen. 2.System.out.print(“Hello World”); - outputs the string “Hello World” on the screen. This string is not followed by a new line. 3.Some Escape Sequence – \n – stands for new line character \t – stands for tab character

10 nlp-ai@cse.iitb Some common errors in the initial phase of learning programming: - Mismatch of parentheses - Missing ‘;’ at the end of statement - Case sensitivity The best way to learn programming is writing a lot of programs on your own.

11 nlp-ai@cse.iitb 1.Write a program which prints the following information about at least 5 persons: NAME MAIL-ID EMPLOYEE-CODE PHONE Eg. Umesh umesh@cse p03161 25764728umesh@cse Salil salil@cse p03160 25764728salil@cse Each entry should be on a separate line. 2.Write a program that prints the following line on the screen along with quotes. “Can we print ‘\’ with System.out.println() statement?”

12 nlp-ai@cse.iitb Thank you…

Download ppt "“Introduction to Programming With Java”"

Similar presentations

Ads by Google