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

Java Session

The document provides an introduction to the Java programming language. It discusses several topics that will be covered, including an introduction to Java, its features such as being platform independent and object oriented, the principles of object-oriented programming including classes, objects, encapsulation, abstraction, and inheritance. It also gives examples of a simple first Java program, control statements including if statements and loops like for and while loops, and concludes with a question and answer section.

Uploaded by

Thaneesh Prakash
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Java Session

The document provides an introduction to the Java programming language. It discusses several topics that will be covered, including an introduction to Java, its features such as being platform independent and object oriented, the principles of object-oriented programming including classes, objects, encapsulation, abstraction, and inheritance. It also gives examples of a simple first Java program, control statements including if statements and loops like for and while loops, and concludes with a question and answer section.

Uploaded by

Thaneesh Prakash
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

In this session Following topics to be covered

Introduction
Features of Java
What is OOPS ?
My First Program
Control Statements
Introduction
Java is a high level programming language by sun microsystems
It was originally called oak by James Gosling. Later it was renamed as java.
Java was designed for consumer electronic devices like tvs, vcrs,
toasters,cell phones, web servers and other electronic devices.
Existing C and C++ had limitations in reliability and portability.
Java is modeled as simple, reliable, portable and powerful.
Features of Java - WORA
Platform Independent
Object Oriented
Compiled and Interpreted
Multithreaded
Secure
Portable
Platform Independent
Principles of OOPs OOP is a methodology that
Classes & Objects – Classes
instance of a class.
Encapsulation – Hiding data
access.
Abstraction – Provide users
Inheritance – process by wh
objects of another class.
Multithreading
Multithreading in java is a process of executing multiple tasks
simultaneously.
Example program
class first
{
public static void main(String args[])
{
System.out.println(“welcome to java”);
}
}
Control Statements
If statement
The if statement is a decision making system and used to control the flow of
the execution of the statements.
Example
import java.util.Scanner;
class first
{
public static void main(String[] arg)
{
int a,b,c,d,e;
Scanner ss = new Scanner(System.in);
System.out.println("enter 5 marks");
a = ss.nextInt();
b = ss.nextInt();
c = ss.nextInt();
d = ss.nextInt();
e = ss.nextInt();
if ((a>=30) && (b>=30) && (c>=30) && (d>=30 ) && (e>=30))
System.out.println("passed");
else
System.out.println("failed“);
}
}
For loop
Used to execute the set of statements for n number of times. The syntax is
for (initialization; expression; increment)
{
set of statements;
}
Example
class forexample
{
public static void main(String[] arg)
{
for(int i=1;i<=10;i=i+2)
System.out.println(i);
}
}
While loop While Loop
The syntax is
while (expression)
{
statements; IS
Logical – No
} Expression
True
Example :
class whileexample
{
public static void main(String[] args) Yes

{
Statement
int k;
k=0;
while (k<10)
{
System.out.println(k++); Statement
}
}
}
Q&A

You might also like