0% found this document useful (0 votes)
106 views

Java Lect 01

This document provides an introduction and overview for a lecture series on programming with Java. The summary includes: - The lecture will cover the structure of Java programs, input/output, statements, conditional statements, loops, arrays, strings, and functions. - Recommended books and references are provided, including titles on Java and introductory Java programming tutorials. - An example "Hello World" Java program is shown to demonstrate the basic structure of a Java program, how to compile it with javac, and run it with java.

Uploaded by

rajkale100
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views

Java Lect 01

This document provides an introduction and overview for a lecture series on programming with Java. The summary includes: - The lecture will cover the structure of Java programs, input/output, statements, conditional statements, loops, arrays, strings, and functions. - Recommended books and references are provided, including titles on Java and introductory Java programming tutorials. - An example "Hello World" Java program is shown to demonstrate the basic structure of a Java program, how to compile it with javac, and run it with java.

Uploaded by

rajkale100
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 12

Welcome to the Lecture

Series on
nlp-ai@cse.iitb
Introduction to Programming
With Java
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)
Syllabus

nlp-ai@cse.iitb
1. Java 2: The Complete Reference
Patrick Naughton, Herbert Schildt

2. Thinking in Java (http://www.mindview.net/Books/TIJ/)
Bruce Eckel

3. Richard G Baldwins Introductory Java Programming
Tutorial on: http://www.dickbaldwin.com/tocint.htm

Books & References

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

nlp-ai@cse.iitb

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
class class-name {
public static void main(String args[]) {
statement1;
statement2;


}
}
Structure of Java Programs

nlp-ai@cse.iitb
First.java
class First {

public static void main(String args[]) {
System.out.println(Hello World);
}

}
Example Program

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 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
Compiling & Running the Program

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
About Printing on the Screen

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.

Some Tips About Programming

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 25764728
Salil salil@cse p03160 25764728
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?
Some Assignments

nlp-ai@cse.iitb
Thank you
End

You might also like