SlideShare uma empresa Scribd logo
1 de 47
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

Mais conteúdo relacionado

Mais procurados (20)

Features of java
Features of javaFeatures of java
Features of java
 
Python programming : Control statements
Python programming : Control statementsPython programming : Control statements
Python programming : Control statements
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Method overloading
Method overloadingMethod overloading
Method overloading
 
class and objects
class and objectsclass and objects
class and objects
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
 
Java History
Java HistoryJava History
Java History
 
Operators in java
Operators in javaOperators in java
Operators in java
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
ITFT-Constants, variables and data types in java
ITFT-Constants, variables and data types in javaITFT-Constants, variables and data types in java
ITFT-Constants, variables and data types in java
 
Operators in java
Operators in javaOperators in java
Operators in java
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
 
Java Basic Oops Concept
Java Basic Oops ConceptJava Basic Oops Concept
Java Basic Oops Concept
 
JAVA ENVIRONMENT
JAVA  ENVIRONMENTJAVA  ENVIRONMENT
JAVA ENVIRONMENT
 
Python ppt
Python pptPython ppt
Python ppt
 
stack presentation
stack presentationstack presentation
stack presentation
 
C programming for problem solving
C programming for problem solving  C programming for problem solving
C programming for problem solving
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
Programming in Java
Programming in JavaProgramming in Java
Programming in Java
 
VB net lab.pdf
VB net lab.pdfVB net lab.pdf
VB net lab.pdf
 

Semelhante a Java ppt (20)

Java Programs
Java ProgramsJava Programs
Java Programs
 
Computer programming 2 chapter 1-lesson 2
Computer programming 2  chapter 1-lesson 2Computer programming 2  chapter 1-lesson 2
Computer programming 2 chapter 1-lesson 2
 
Java 5 and 6 New Features
Java 5 and 6 New FeaturesJava 5 and 6 New Features
Java 5 and 6 New Features
 
Java programs
Java programsJava programs
Java programs
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streams
 
Object oriented programming la bmanual jntu
Object oriented programming la bmanual jntuObject oriented programming la bmanual jntu
Object oriented programming la bmanual jntu
 
Lec 5 13_aug [compatibility mode]
Lec 5 13_aug [compatibility mode]Lec 5 13_aug [compatibility mode]
Lec 5 13_aug [compatibility mode]
 
New features and enhancement
New features and enhancementNew features and enhancement
New features and enhancement
 
Reading and writting v2
Reading and writting v2Reading and writting v2
Reading and writting v2
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
Core java
Core javaCore java
Core java
 
Learning Java 1 – Introduction
Learning Java 1 – IntroductionLearning Java 1 – Introduction
Learning Java 1 – Introduction
 
final year project center in Coimbatore
final year project center in Coimbatorefinal year project center in Coimbatore
final year project center in Coimbatore
 
Java 8 new features
Java 8 new featuresJava 8 new features
Java 8 new features
 
Class notes(week 5) on command line arguments
Class notes(week 5) on command line argumentsClass notes(week 5) on command line arguments
Class notes(week 5) on command line arguments
 
Class notes(week 5) on command line arguments
Class notes(week 5) on command line argumentsClass notes(week 5) on command line arguments
Class notes(week 5) on command line arguments
 
02basics
02basics02basics
02basics
 
Core java Essentials
Core java EssentialsCore java Essentials
Core java Essentials
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentation
 

Último

FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 

Último (20)

FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 

Java ppt

  • 2. what is the meaning of true object oriented If we want to do anything in java must be within a class
  • 3. 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
  • 4. 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
  • 5. 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
  • 6. e.g. class Firstprog { public static void main(String x[]) { System.out.println(“Hi I am java"); } }
  • 7. 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
  • 8. 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)
  • 9. 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]);
  • 10. 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();
  • 11. 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); } }
  • 12. 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
  • 13. 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
  • 14. 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);
  • 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.*; 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");
  • 19. //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"); }
  • 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 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
  • 23. 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
  • 24. 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 ");
  • 25. marks=xyz.nextFloat(); System.out.println("Name is "+name); System.out.println("Id is "+id); System.out.println("Marks is "+marks); } }