1 / 12

Welcome to the Lecture Series on

Welcome to the Lecture Series on. “ Introduction to Programming With Java ”. nlp-ai@cse.iitb. Syllabus. Structure of Java programs Input and output to screen with Java program Statements Conditional statements Loop constructs Arrays, character and string handling

milla
Download Presentation

Welcome to the Lecture Series on

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Welcome to the Lecture Series on “Introduction to Programming With Java” nlp-ai@cse.iitb

  2. Syllabus • 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) nlp-ai@cse.iitb

  3. Books & References • Java 2: The Complete Reference • – Patrick Naughton, Herbert Schildt • Thinking in Java (http://www.mindview.net/Books/TIJ/) • – Bruce Eckel • 3. Richard G Baldwin’s “Introductory Java Programming • Tutorial” on: http://www.dickbaldwin.com/tocint.htm nlp-ai@cse.iitb

  4. Contents for Today’s Lecture • Structure of Java programs • Compiling and running the program • Printing messages to the screen nlp-ai@cse.iitb

  5. Some Basics 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. nlp-ai@cse.iitb

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

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

  8. Compiling & Running the Program Compiling: is the process of translating source code written in a particular programming language into computer-readable machine code that can be executed. $ javac First.java 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 nlp-ai@cse.iitb

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

  10. Some Tips About Programming • 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. nlp-ai@cse.iitb

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

  12. End Thank you… nlp-ai@cse.iitb

More Related