際際滷

際際滷Share a Scribd company logo
Exercises for Week 1
Public static void main (String args[]) The public keyword is an access specifier, which allows the programmer to control the visibility of class members. When a class member is preceded by public, then that member may be accessed by code outside the class in which it is declared.In this case, main( ) must be declared as public, since it must be called by code outside of its class when the program is started. The keyword static allows main( ) to be called without having to instantiate a particular instance of the class. This is necessary since main( ) is called by the Java interpreter before any objects are made. The keyword void simply tells the compiler that main( ) does not return a value. As you will see, methods may also return values.油 As stated, main( ) is the method called when a Java application begins. Keep in mind that Java is case-sensitive. Thus, Main is different from main. It is important to understand that the Java compiler will compile classes that do not contain a main( ) method. But the Java interpreter has no way to run these classes. So, if you had typed Main instead of main, the compiler would still compile your program. However, the Java interpreter would report an error because it would be unable to find the main( ) method.油 Any information that you need to pass to a method is received by variables specified within the set of parentheses that follow the name of the method. These variables are called parameters. If there are no parameters required for a given method, you still need to include the empty parentheses. In main( ), there is only one parameter, albeit a complicated one. String args[ ] declares a parameter named args, which is an array of instances of the class String. Objects of type String store character strings. In this case, args receives any command-line arguments present when the program is executed.
Class BufferedReader http://java.sun.com/j2se/1.4.2/docs/api/java/io/BufferedReader.html   Read text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines. The buffer size may be specified, or the default size may be used. The default is large enough for most purposes. In general, each read request made of a Reader causes a corresponding read request to be made of the underlying character or byte stream. It is therefore advisable to wrap a BufferedReader around any Reader whose read() operations may be costly, such as File Readers and InputStreamReaders. For example, BufferedReader in = new BufferedReader(new FileReader("foo.in")); will buffer the input from the specified file. Without buffering, each invocation of read() or readLine() could cause bytes to be read from the file, converted into characters, and then returned, which can be very inefficient. Programs that use DataInputStreams for textual input can be localized by replacing each DataInputStream with an appropriate BufferedReader.
Class InputStreamReader An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified油 charset . The charset that it uses may be specified by name or may be given explicitly, or the platform's default charset may be accepted. Each invocation of one of an InputStreamReader's read() methods may cause one or more bytes to be read from the underlying byte-input stream. To enable the efficient conversion of bytes to characters, more bytes may be read ahead from the underlying stream than are necessary to satisfy the current read operation. For top efficiency, consider wrapping an InputStreamReader within a BufferedReader. For example: BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
NOW TRY TO CREATE YOR OWN SLAM BOOK HAVING 15 QUESTIONS
CREATE A SIMPLE CALCULATOR THAT CAN PERFORM + - / * AND %
CREATE A PROGRAM TEPMPERATURE  CONVERSION PROGRAM
油
WRITE AN ARRAY LIST THAT DIPLAY ALL  THE MONTHS OF THE YEAR
油
WRITE A MESSAGE OR ANY COMMENT ABOUT YOUR INSTRUCTOR
DENOMINATION COUNTER PART1
DENOMINATION COUNTER PART 2
DENOMINATION COUNTER PART3
油
Create a program that will compute for the weight of an object weight (kg)  equal to mass multiplied by gravitational pull of the earth(9.8 meter/sec).
油
油
FOOD FOR THE BRAIN  Displays a message with no icons  YES JOptionPane.PLAIN_MESSAGE Display Questions YES JOptionPane.QUESTION_MESSAGE Warning display YES JOptionPane.WARNING_MESSAGE Information display YES JOptionPane.INFORMATION_MESSAGE Error message display YES JOptionPane.ERROR_MESSAGE DESCRIPTION ICON MESSAGE DIALOG TYPE
油
油

More Related Content

What's hot (20)

Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
Synesso
Java 8 Features
Java 8 FeaturesJava 8 Features
Java 8 Features
Leninkumar Koppoju
Major Java 8 features
Major Java 8 featuresMajor Java 8 features
Major Java 8 features
Sanjoy Kumar Roy
C#/.NET Little Pitfalls
C#/.NET Little PitfallsC#/.NET Little Pitfalls
C#/.NET Little Pitfalls
BlackRabbitCoder
Java 8 - Features Overview
Java 8 - Features OverviewJava 8 - Features Overview
Java 8 - Features Overview
Sergii Stets
Let's start with Java- Basic Concepts
Let's start with Java- Basic ConceptsLet's start with Java- Basic Concepts
Let's start with Java- Basic Concepts
Aashish Jain
Java 8 lambda
Java 8 lambdaJava 8 lambda
Java 8 lambda
Manav Prasad
javascript 1
javascript 1javascript 1
javascript 1
osman do
Scala tutorial
Scala tutorialScala tutorial
Scala tutorial
Murali Krishna
java 8 new features
java 8 new features java 8 new features
java 8 new features
Rohit Verma
Ruby Interview Questions
Ruby Interview QuestionsRuby Interview Questions
Ruby Interview Questions
Sumanth krishna
Handout # 4 functions + scopes
Handout # 4   functions + scopes Handout # 4   functions + scopes
Handout # 4 functions + scopes
NUST Stuff
Expression language in mule
Expression language in muleExpression language in mule
Expression language in mule
Son Nguyen
Jsp tag library
Jsp tag libraryJsp tag library
Jsp tag library
sandeep54552
Python algorithm
Python algorithmPython algorithm
Python algorithm
Prof. Dr. K. Adisesha
Primitive data types
Primitive data typesPrimitive data types
Primitive data types
bad_zurbic
Java se 8 language enhancements & features
Java se 8   language enhancements & featuresJava se 8   language enhancements & features
Java se 8 language enhancements & features
Juarez Junior
Lec 1.4 Object Oriented Programming
Lec 1.4 Object Oriented ProgrammingLec 1.4 Object Oriented Programming
Lec 1.4 Object Oriented Programming
Badar Waseer
Ap Power Point Chpt5
Ap Power Point Chpt5Ap Power Point Chpt5
Ap Power Point Chpt5
dplunkett
Mule Expression language
Mule Expression languageMule Expression language
Mule Expression language
Mani Rathnam Gudi
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
Synesso
C#/.NET Little Pitfalls
C#/.NET Little PitfallsC#/.NET Little Pitfalls
C#/.NET Little Pitfalls
BlackRabbitCoder
Java 8 - Features Overview
Java 8 - Features OverviewJava 8 - Features Overview
Java 8 - Features Overview
Sergii Stets
Let's start with Java- Basic Concepts
Let's start with Java- Basic ConceptsLet's start with Java- Basic Concepts
Let's start with Java- Basic Concepts
Aashish Jain
javascript 1
javascript 1javascript 1
javascript 1
osman do
java 8 new features
java 8 new features java 8 new features
java 8 new features
Rohit Verma
Ruby Interview Questions
Ruby Interview QuestionsRuby Interview Questions
Ruby Interview Questions
Sumanth krishna
Handout # 4 functions + scopes
Handout # 4   functions + scopes Handout # 4   functions + scopes
Handout # 4 functions + scopes
NUST Stuff
Expression language in mule
Expression language in muleExpression language in mule
Expression language in mule
Son Nguyen
Jsp tag library
Jsp tag libraryJsp tag library
Jsp tag library
sandeep54552
Primitive data types
Primitive data typesPrimitive data types
Primitive data types
bad_zurbic
Java se 8 language enhancements & features
Java se 8   language enhancements & featuresJava se 8   language enhancements & features
Java se 8 language enhancements & features
Juarez Junior
Lec 1.4 Object Oriented Programming
Lec 1.4 Object Oriented ProgrammingLec 1.4 Object Oriented Programming
Lec 1.4 Object Oriented Programming
Badar Waseer
Ap Power Point Chpt5
Ap Power Point Chpt5Ap Power Point Chpt5
Ap Power Point Chpt5
dplunkett

Viewers also liked (6)

Presentation1
Presentation1Presentation1
Presentation1
DALYBABBIE
Intuit commissions manager
Intuit commissions managerIntuit commissions manager
Intuit commissions manager
sshhzap
Padovani margherita 2010_11_esercizio4
Padovani margherita 2010_11_esercizio4Padovani margherita 2010_11_esercizio4
Padovani margherita 2010_11_esercizio4
EmpiMaggie
2011 02-09 run on sentences
2011 02-09 run on sentences2011 02-09 run on sentences
2011 02-09 run on sentences
nusspix
Chapter 2.2 data structures
Chapter 2.2 data structuresChapter 2.2 data structures
Chapter 2.2 data structures
sshhzap
05 Loops
05  Loops05  Loops
05 Loops
Art Origin
Presentation1
Presentation1Presentation1
Presentation1
DALYBABBIE
Intuit commissions manager
Intuit commissions managerIntuit commissions manager
Intuit commissions manager
sshhzap
Padovani margherita 2010_11_esercizio4
Padovani margherita 2010_11_esercizio4Padovani margherita 2010_11_esercizio4
Padovani margherita 2010_11_esercizio4
EmpiMaggie
2011 02-09 run on sentences
2011 02-09 run on sentences2011 02-09 run on sentences
2011 02-09 run on sentences
nusspix
Chapter 2.2 data structures
Chapter 2.2 data structuresChapter 2.2 data structures
Chapter 2.2 data structures
sshhzap

Similar to Exercises for ja se (20)

An Overview Of Java | Object Oriented Programming
An Overview Of Java | Object Oriented ProgrammingAn Overview Of Java | Object Oriented Programming
An Overview Of Java | Object Oriented Programming
ArghyaGayen1
Java 8 Interview Questions and Answers PDF By ScholarHat.pdf
Java 8 Interview Questions and Answers PDF By ScholarHat.pdfJava 8 Interview Questions and Answers PDF By ScholarHat.pdf
Java 8 Interview Questions and Answers PDF By ScholarHat.pdf
Scholarhat
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
Rich Helton
Java files and io streams
Java files and io streamsJava files and io streams
Java files and io streams
RubaNagarajan
Colloquium Report
Colloquium ReportColloquium Report
Colloquium Report
Mohammad Faizan
Annotations
AnnotationsAnnotations
Annotations
Knoldus Inc.
Basics of java 2
Basics of java 2Basics of java 2
Basics of java 2
Raghu nath
Java OOP Concepts 1st 際際滷
Java OOP Concepts 1st 際際滷Java OOP Concepts 1st 際際滷
Java OOP Concepts 1st 際際滷
sunny khan
Java 8-revealed
Java 8-revealedJava 8-revealed
Java 8-revealed
Hamed Hatami
Wk_10_Scanner and BufferedReader Class in Java.pptx
Wk_10_Scanner and BufferedReader Class in Java.pptxWk_10_Scanner and BufferedReader Class in Java.pptx
Wk_10_Scanner and BufferedReader Class in Java.pptx
percivalfernandez2
Stream In Java.pptx
Stream In Java.pptxStream In Java.pptx
Stream In Java.pptx
ssuser9d7049
OOP-Chap2.docx
OOP-Chap2.docxOOP-Chap2.docx
OOP-Chap2.docx
NaorinHalim
Mpl 1
Mpl 1Mpl 1
Mpl 1
AHHAAH
Introduction
IntroductionIntroduction
Introduction
richsoden
Functional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singhFunctional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singh
Harmeet Singh(Taara)
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
Todor Kolev
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
Todor Kolev
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
Todor Kolev
JAVA_BASICS_Data_abstraction_encapsulation.ppt
JAVA_BASICS_Data_abstraction_encapsulation.pptJAVA_BASICS_Data_abstraction_encapsulation.ppt
JAVA_BASICS_Data_abstraction_encapsulation.ppt
VGaneshKarthikeyan
Bt0074 oops with java2
Bt0074 oops with java2Bt0074 oops with java2
Bt0074 oops with java2
Techglyphs
An Overview Of Java | Object Oriented Programming
An Overview Of Java | Object Oriented ProgrammingAn Overview Of Java | Object Oriented Programming
An Overview Of Java | Object Oriented Programming
ArghyaGayen1
Java 8 Interview Questions and Answers PDF By ScholarHat.pdf
Java 8 Interview Questions and Answers PDF By ScholarHat.pdfJava 8 Interview Questions and Answers PDF By ScholarHat.pdf
Java 8 Interview Questions and Answers PDF By ScholarHat.pdf
Scholarhat
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
Rich Helton
Java files and io streams
Java files and io streamsJava files and io streams
Java files and io streams
RubaNagarajan
Basics of java 2
Basics of java 2Basics of java 2
Basics of java 2
Raghu nath
Java OOP Concepts 1st 際際滷
Java OOP Concepts 1st 際際滷Java OOP Concepts 1st 際際滷
Java OOP Concepts 1st 際際滷
sunny khan
Java 8-revealed
Java 8-revealedJava 8-revealed
Java 8-revealed
Hamed Hatami
Wk_10_Scanner and BufferedReader Class in Java.pptx
Wk_10_Scanner and BufferedReader Class in Java.pptxWk_10_Scanner and BufferedReader Class in Java.pptx
Wk_10_Scanner and BufferedReader Class in Java.pptx
percivalfernandez2
Stream In Java.pptx
Stream In Java.pptxStream In Java.pptx
Stream In Java.pptx
ssuser9d7049
OOP-Chap2.docx
OOP-Chap2.docxOOP-Chap2.docx
OOP-Chap2.docx
NaorinHalim
Mpl 1
Mpl 1Mpl 1
Mpl 1
AHHAAH
Introduction
IntroductionIntroduction
Introduction
richsoden
Functional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singhFunctional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singh
Harmeet Singh(Taara)
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
Todor Kolev
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
Todor Kolev
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
Todor Kolev
JAVA_BASICS_Data_abstraction_encapsulation.ppt
JAVA_BASICS_Data_abstraction_encapsulation.pptJAVA_BASICS_Data_abstraction_encapsulation.ppt
JAVA_BASICS_Data_abstraction_encapsulation.ppt
VGaneshKarthikeyan
Bt0074 oops with java2
Bt0074 oops with java2Bt0074 oops with java2
Bt0074 oops with java2
Techglyphs

Recently uploaded (20)

A PPT on the First Three chapters of Wings of Fire
A PPT on the First Three chapters of Wings of FireA PPT on the First Three chapters of Wings of Fire
A PPT on the First Three chapters of Wings of Fire
Beena E S
ITI Turner Question Paper MCQ E-Book Free Download
ITI Turner Question Paper MCQ E-Book Free DownloadITI Turner Question Paper MCQ E-Book Free Download
ITI Turner Question Paper MCQ E-Book Free Download
SONU HEETSON
How to Configure Deliver Content by Email in Odoo 18 Sales
How to Configure Deliver Content by Email in Odoo 18 SalesHow to Configure Deliver Content by Email in Odoo 18 Sales
How to Configure Deliver Content by Email in Odoo 18 Sales
Celine George
Full-Stack .NET Developer Interview Questions PDF By ScholarHat
Full-Stack .NET Developer Interview Questions PDF By ScholarHatFull-Stack .NET Developer Interview Questions PDF By ScholarHat
Full-Stack .NET Developer Interview Questions PDF By ScholarHat
Scholarhat
MELC: Follows ethical standards in writing related literature
MELC: Follows ethical standards in writing related literatureMELC: Follows ethical standards in writing related literature
MELC: Follows ethical standards in writing related literature
joverlynbalansag1
How to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 EmployeeHow to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 Employee
Celine George
Digital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptxDigital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptx
Dr. Sarita Anand
BISNIS BERKAH BERANGKAT KE MEKKAH ISTIKMAL SYARIAH
BISNIS BERKAH BERANGKAT KE MEKKAH ISTIKMAL SYARIAHBISNIS BERKAH BERANGKAT KE MEKKAH ISTIKMAL SYARIAH
BISNIS BERKAH BERANGKAT KE MEKKAH ISTIKMAL SYARIAH
coacharyasetiyaki
lklklklklklklklklklklklklklklklklklklklklklklklklklklklk
lklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklk
lklklklklklklklklklklklklklklklklklklklklklklklklklklklk
preetheshparmar
Azure Administrator Interview Questions By ScholarHat
Azure Administrator Interview Questions By ScholarHatAzure Administrator Interview Questions By ScholarHat
Azure Administrator Interview Questions By ScholarHat
Scholarhat
ASP.NET Interview Questions PDF By ScholarHat
ASP.NET  Interview Questions PDF By ScholarHatASP.NET  Interview Questions PDF By ScholarHat
ASP.NET Interview Questions PDF By ScholarHat
Scholarhat
Discharge procedure and its types in hospital .pptx
Discharge procedure and its types in hospital .pptxDischarge procedure and its types in hospital .pptx
Discharge procedure and its types in hospital .pptx
PoojaSen20
Year 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptxYear 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptx
mansk2
GRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptx
GRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptxGRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptx
GRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptx
AngellieMaeDoce
Meeting the needs of modern students?, Selina McCoy
Meeting the needs of modern students?, Selina McCoyMeeting the needs of modern students?, Selina McCoy
Meeting the needs of modern students?, Selina McCoy
Economic and Social Research Institute
Rest API Interview Questions PDF By ScholarHat
Rest API Interview Questions PDF By ScholarHatRest API Interview Questions PDF By ScholarHat
Rest API Interview Questions PDF By ScholarHat
Scholarhat
Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdfBlind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Ajaz Hussain
NUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdf
NUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdfNUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdf
NUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdf
Dolisha Warbi
Managing expiration dates of products in odoo
Managing expiration dates of products in odooManaging expiration dates of products in odoo
Managing expiration dates of products in odoo
Celine George
How to Unblock Payment in Odoo 18 Accounting
How to Unblock Payment in Odoo 18 AccountingHow to Unblock Payment in Odoo 18 Accounting
How to Unblock Payment in Odoo 18 Accounting
Celine George
A PPT on the First Three chapters of Wings of Fire
A PPT on the First Three chapters of Wings of FireA PPT on the First Three chapters of Wings of Fire
A PPT on the First Three chapters of Wings of Fire
Beena E S
ITI Turner Question Paper MCQ E-Book Free Download
ITI Turner Question Paper MCQ E-Book Free DownloadITI Turner Question Paper MCQ E-Book Free Download
ITI Turner Question Paper MCQ E-Book Free Download
SONU HEETSON
How to Configure Deliver Content by Email in Odoo 18 Sales
How to Configure Deliver Content by Email in Odoo 18 SalesHow to Configure Deliver Content by Email in Odoo 18 Sales
How to Configure Deliver Content by Email in Odoo 18 Sales
Celine George
Full-Stack .NET Developer Interview Questions PDF By ScholarHat
Full-Stack .NET Developer Interview Questions PDF By ScholarHatFull-Stack .NET Developer Interview Questions PDF By ScholarHat
Full-Stack .NET Developer Interview Questions PDF By ScholarHat
Scholarhat
MELC: Follows ethical standards in writing related literature
MELC: Follows ethical standards in writing related literatureMELC: Follows ethical standards in writing related literature
MELC: Follows ethical standards in writing related literature
joverlynbalansag1
How to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 EmployeeHow to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 Employee
Celine George
Digital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptxDigital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptx
Dr. Sarita Anand
BISNIS BERKAH BERANGKAT KE MEKKAH ISTIKMAL SYARIAH
BISNIS BERKAH BERANGKAT KE MEKKAH ISTIKMAL SYARIAHBISNIS BERKAH BERANGKAT KE MEKKAH ISTIKMAL SYARIAH
BISNIS BERKAH BERANGKAT KE MEKKAH ISTIKMAL SYARIAH
coacharyasetiyaki
lklklklklklklklklklklklklklklklklklklklklklklklklklklklk
lklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklklk
lklklklklklklklklklklklklklklklklklklklklklklklklklklklk
preetheshparmar
Azure Administrator Interview Questions By ScholarHat
Azure Administrator Interview Questions By ScholarHatAzure Administrator Interview Questions By ScholarHat
Azure Administrator Interview Questions By ScholarHat
Scholarhat
ASP.NET Interview Questions PDF By ScholarHat
ASP.NET  Interview Questions PDF By ScholarHatASP.NET  Interview Questions PDF By ScholarHat
ASP.NET Interview Questions PDF By ScholarHat
Scholarhat
Discharge procedure and its types in hospital .pptx
Discharge procedure and its types in hospital .pptxDischarge procedure and its types in hospital .pptx
Discharge procedure and its types in hospital .pptx
PoojaSen20
Year 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptxYear 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptx
mansk2
GRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptx
GRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptxGRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptx
GRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptx
AngellieMaeDoce
Rest API Interview Questions PDF By ScholarHat
Rest API Interview Questions PDF By ScholarHatRest API Interview Questions PDF By ScholarHat
Rest API Interview Questions PDF By ScholarHat
Scholarhat
Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdfBlind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Ajaz Hussain
NUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdf
NUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdfNUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdf
NUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdf
Dolisha Warbi
Managing expiration dates of products in odoo
Managing expiration dates of products in odooManaging expiration dates of products in odoo
Managing expiration dates of products in odoo
Celine George
How to Unblock Payment in Odoo 18 Accounting
How to Unblock Payment in Odoo 18 AccountingHow to Unblock Payment in Odoo 18 Accounting
How to Unblock Payment in Odoo 18 Accounting
Celine George

Exercises for ja se

  • 2. Public static void main (String args[]) The public keyword is an access specifier, which allows the programmer to control the visibility of class members. When a class member is preceded by public, then that member may be accessed by code outside the class in which it is declared.In this case, main( ) must be declared as public, since it must be called by code outside of its class when the program is started. The keyword static allows main( ) to be called without having to instantiate a particular instance of the class. This is necessary since main( ) is called by the Java interpreter before any objects are made. The keyword void simply tells the compiler that main( ) does not return a value. As you will see, methods may also return values.油 As stated, main( ) is the method called when a Java application begins. Keep in mind that Java is case-sensitive. Thus, Main is different from main. It is important to understand that the Java compiler will compile classes that do not contain a main( ) method. But the Java interpreter has no way to run these classes. So, if you had typed Main instead of main, the compiler would still compile your program. However, the Java interpreter would report an error because it would be unable to find the main( ) method.油 Any information that you need to pass to a method is received by variables specified within the set of parentheses that follow the name of the method. These variables are called parameters. If there are no parameters required for a given method, you still need to include the empty parentheses. In main( ), there is only one parameter, albeit a complicated one. String args[ ] declares a parameter named args, which is an array of instances of the class String. Objects of type String store character strings. In this case, args receives any command-line arguments present when the program is executed.
  • 3. Class BufferedReader http://java.sun.com/j2se/1.4.2/docs/api/java/io/BufferedReader.html Read text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines. The buffer size may be specified, or the default size may be used. The default is large enough for most purposes. In general, each read request made of a Reader causes a corresponding read request to be made of the underlying character or byte stream. It is therefore advisable to wrap a BufferedReader around any Reader whose read() operations may be costly, such as File Readers and InputStreamReaders. For example, BufferedReader in = new BufferedReader(new FileReader("foo.in")); will buffer the input from the specified file. Without buffering, each invocation of read() or readLine() could cause bytes to be read from the file, converted into characters, and then returned, which can be very inefficient. Programs that use DataInputStreams for textual input can be localized by replacing each DataInputStream with an appropriate BufferedReader.
  • 4. Class InputStreamReader An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified油 charset . The charset that it uses may be specified by name or may be given explicitly, or the platform's default charset may be accepted. Each invocation of one of an InputStreamReader's read() methods may cause one or more bytes to be read from the underlying byte-input stream. To enable the efficient conversion of bytes to characters, more bytes may be read ahead from the underlying stream than are necessary to satisfy the current read operation. For top efficiency, consider wrapping an InputStreamReader within a BufferedReader. For example: BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  • 5. NOW TRY TO CREATE YOR OWN SLAM BOOK HAVING 15 QUESTIONS
  • 6. CREATE A SIMPLE CALCULATOR THAT CAN PERFORM + - / * AND %
  • 7. CREATE A PROGRAM TEPMPERATURE CONVERSION PROGRAM
  • 8.
  • 9. WRITE AN ARRAY LIST THAT DIPLAY ALL THE MONTHS OF THE YEAR
  • 10.
  • 11. WRITE A MESSAGE OR ANY COMMENT ABOUT YOUR INSTRUCTOR
  • 15.
  • 16. Create a program that will compute for the weight of an object weight (kg) equal to mass multiplied by gravitational pull of the earth(9.8 meter/sec).
  • 17.
  • 18.
  • 19. FOOD FOR THE BRAIN Displays a message with no icons YES JOptionPane.PLAIN_MESSAGE Display Questions YES JOptionPane.QUESTION_MESSAGE Warning display YES JOptionPane.WARNING_MESSAGE Information display YES JOptionPane.INFORMATION_MESSAGE Error message display YES JOptionPane.ERROR_MESSAGE DESCRIPTION ICON MESSAGE DIALOG TYPE
  • 20.
  • 21.