Rohan K.Gajre.
what is the meaning of true object
oriented
If we want to do anything in java must be
within a class
what is the meaning of
program compilation
Compilation means to convert your actual
programme or source code in to the
machine code or byte code
Machine code machine independent
Run or execute on any operating system
or plat forms is called as platform
independent this is a feature of java
what is public static void
main(String x[])
This is the main function of java same like
as main function in c
Static content can share all members in
application so main is available in whole
application
Static content load in memory very first
when program run. for program execution
main method must be load in memory so
main is static
what is String x[]
This is a command line argument in java
If we pass the any parameter to main
function is called as command line
argument
what is the use of command line argument in
java
To provide the run time input
e.g.
class Firstprog
{
public static void main(String x[])
{
System.out.println(“Hi I am java");
}
}
How to cross check byte code
created or not
After the program compile java create
the one new file automatically is called
as .class file and in this file contain byte
code
Use the command line argument
If you want provide the input at run
time
Use the command line argument
Or
Java provide the some inbuilt classes for
input. Command line argument is infinite
string array means we can pass the n
number of input through the command line
argument but the first input start with
zero index(basic array rule)
type casting
how to perform the type casting or
type conversion in java
for that java provide some inbuilt classes
for conversion is called as wrapper classes
syntax -->
integervariable=Integer.parseInt(value for conversion|);
e.g. a=Integer.parseInt(x[0]);
Integer is a class in java and parseInt() is
the static method of Integer class this
method is used to convert the any value.
floatvriable=Float.parseFloat(value);
or
Float.valueOf(value).floatValue();
public class FirstBatch{
public static void main(String x[])
{ int a,b,c;
a=Integer.parseInt(x[0]);
b=Integer.parseInt(x[1]);
c=a+b;
System.out.println("Addition is "+c);
}
}
DataInputStream
This class is used to accept the input
from keyboard same like as scanf() in c
this class is a member of java.io package
 To add follow some step’s
Add java.io. pacakge in programme
package is a collection of classes same like
as header file in c
header file is a collection of functions in c
import packagename;
e.g. import java.io.*; -->this statement
allow us to use all classes present in
java.io.
import java.io.DataInputStream;-->we can
use only one class in program from java.io
package
import is the keyword in java which is used
to add the package in program
create the object of DataInputStream
class
if we want to use the class and its
member any where for that we need to
object
Synatx
DataInputStream objectname=new DataInputStream(System.in);
Or
DataInputStream objectname;
objectname=new DataInputStream(System.in); 
E.g..
DataInputStream input=new
DataInputStream(System.in);
use its readLine() method for input
readLine() is the method of
DataInputStream class which is used to
accept the input from keyboard
Use of readLine() method
objectofdatainputstream.readLine()
//P1 import java.io.*;
public class DataFirst
{
public static void main(String x[])throws
Exception
{
DataInputStream xyz=new DataInputStream(System.in);
int num,sq;
System.out.println("Enter the number");
num=Integer.parseInt(xyz.readLine());
sq=num*num;
System.out.println("square is "+sq);
}
}
//P2
import java.io.*;
public class Student
{
public static void main(String x[])throws Exception
{
DataInputStream input=new DataInputStream(System.in);
int number;
String name;
float marks;
System.out.println("enter the name of student");
name=input.readLine();
System.out.println("Enter the id of student");
number=Integer.parseInt(input.readLine());
System.out.println("Enter the marks of student");
}
marks=Float.valueOf(input.readLine()).floatValue();
System.out.println("Name of student "+name);
System.out.println("Id of student is "+number);
System.out.println("Marks of student is "+marks);
}
Problem with readLine() method
Need to convert for every input other than
string for that java provide the another
optional class for input to us Scanner .
Scanner is a class same like as
DataInputStram Scanner is a member of
java.util package
 add the util package in programme
import java.util.*;
create the object of Scanner class
Scanner object=new Scanner(System.in);
e.g Scanner input=new Scanner(System.in);
Use its following method for input
nextInt() --> for integer input
nextFloat() ---> for float input
nextDouble() --> for double input
nextByte() --> for byte input
nextLine() ----> for string input
nextShort() -->short integer input
nextLong() ---> for long integer input
import java.util.*;
public class ScannerApp
{
public static void main(String x[])
{
Scanner xyz=new Scanner(System.in);
int id;
float marks;
String name;
System.out.println("Enter the name ");
name=xyz.nextLine();
System.out.println("enter the id ");
id=xyz.nextInt();
System.out.println("enter the marks ");
marks=xyz.nextFloat();
System.out.println("Name is "+name);
System.out.println("Id is "+id);
System.out.println("Marks is "+marks);
}
}
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt
Java ppt

Java ppt

  • 1.
  • 2.
    what is themeaning of true object oriented If we want to do anything in java must be within a class
  • 3.
    what is themeaning of program compilation Compilation means to convert your actual programme or source code in to the machine code or byte code Machine code machine independent Run or execute on any operating system or plat forms is called as platform independent this is a feature of java
  • 4.
    what is publicstatic void main(String x[]) This is the main function of java same like as main function in c Static content can share all members in application so main is available in whole application Static content load in memory very first when program run. for program execution main method must be load in memory so main is static
  • 5.
    what is Stringx[] This is a command line argument in java If we pass the any parameter to main function is called as command line argument what is the use of command line argument in java To provide the run time input
  • 6.
    e.g. class Firstprog { public staticvoid main(String x[]) { System.out.println(“Hi I am java"); } }
  • 7.
    How to crosscheck byte code created or not After the program compile java create the one new file automatically is called as .class file and in this file contain byte code Use the command line argument
  • 8.
    If you wantprovide the input at run time Use the command line argument Or Java provide the some inbuilt classes for input. Command line argument is infinite string array means we can pass the n number of input through the command line argument but the first input start with zero index(basic array rule)
  • 9.
    type casting how toperform the type casting or type conversion in java for that java provide some inbuilt classes for conversion is called as wrapper classes syntax --> integervariable=Integer.parseInt(value for conversion|); e.g. a=Integer.parseInt(x[0]);
  • 10.
    Integer is aclass in java and parseInt() is the static method of Integer class this method is used to convert the any value. floatvriable=Float.parseFloat(value); or Float.valueOf(value).floatValue();
  • 11.
    public class FirstBatch{ publicstatic void main(String x[]) { int a,b,c; a=Integer.parseInt(x[0]); b=Integer.parseInt(x[1]); c=a+b; System.out.println("Addition is "+c); } }
  • 12.
    DataInputStream This class isused to accept the input from keyboard same like as scanf() in c this class is a member of java.io package  To add follow some step’s Add java.io. pacakge in programme package is a collection of classes same like as header file in c header file is a collection of functions in c
  • 13.
    import packagename; e.g. importjava.io.*; -->this statement allow us to use all classes present in java.io. import java.io.DataInputStream;-->we can use only one class in program from java.io package import is the keyword in java which is used to add the package in program
  • 14.
    create the objectof DataInputStream class if we want to use the class and its member any where for that we need to object Synatx DataInputStream objectname=new DataInputStream(System.in);
  • 15.
  • 16.
    use its readLine()method for input readLine() is the method of DataInputStream class which is used to accept the input from keyboard Use of readLine() method objectofdatainputstream.readLine()
  • 17.
    //P1 import java.io.*; publicclass DataFirst { public static void main(String x[])throws Exception { DataInputStream xyz=new DataInputStream(System.in); int num,sq; System.out.println("Enter the number");
  • 18.
  • 19.
    //P2 import java.io.*; public classStudent { public static void main(String x[])throws Exception { DataInputStream input=new DataInputStream(System.in); int number; String name; float marks; System.out.println("enter the name of student"); name=input.readLine(); System.out.println("Enter the id of student"); number=Integer.parseInt(input.readLine()); System.out.println("Enter the marks of student"); }
  • 20.
    marks=Float.valueOf(input.readLine()).floatValue(); System.out.println("Name of student"+name); System.out.println("Id of student is "+number); System.out.println("Marks of student is "+marks); }
  • 21.
    Problem with readLine()method Need to convert for every input other than string for that java provide the another optional class for input to us Scanner .
  • 22.
    Scanner is aclass same like as DataInputStram Scanner is a member of java.util package  add the util package in programme import java.util.*; create the object of Scanner class Scanner object=new Scanner(System.in); e.g Scanner input=new Scanner(System.in); Use its following method for input
  • 23.
    nextInt() --> forinteger input nextFloat() ---> for float input nextDouble() --> for double input nextByte() --> for byte input nextLine() ----> for string input nextShort() -->short integer input nextLong() ---> for long integer input
  • 24.
    import java.util.*; public classScannerApp { public static void main(String x[]) { Scanner xyz=new Scanner(System.in); int id; float marks; String name; System.out.println("Enter the name "); name=xyz.nextLine(); System.out.println("enter the id "); id=xyz.nextInt(); System.out.println("enter the marks ");
  • 25.