SlideShare une entreprise Scribd logo
1  sur  25
Télécharger pour lire hors ligne
INTRODUCTION ON JAVA PROGRAMMING
MS. K.NANTHINI
ASSISTANT PROFESSOR,
KONGU ENGINEERING COLLEGE,
ERODE, TAMILNADU,
Overview
-Programming language and computing platform
-first released by Sun Microsystems in 1995
-Java is a simple, general-purpose, object-oriented, robust, secure, architecture-neutral,
portable, high-performance, multithreaded computer language
-JDK
-JRE
-JVM
write once, run anywhere" (WORA)
History
-James Gosling from Sun Microsystems and his team began designing the first version of Java
aimed at programming home appliances
-Name:Oak-Green-Java
Java Platform
A platform is the hardware or software environment in
which a program runs.
Popular Platforms : Microsoft Windows, Linux, Solaris OS,
and Mac OS - combination of the operating system and
underlying hardware
But Java is software-only platform that runs on top of other
hardware-based platforms
-Components
(Cont.,)
Java Architecture
Components of Java Architecture
Java Virtual Machine:
The JVM is a Java platform component that provides an environment for executing Java
programs. JVM interprets the byte code into machine code which is executed in the machine in
which the Java program runs.
Java Runtime Environment:
The JRE software builds a runtime environment in which Java programs can be executed. The JRE
is the on-disk system that takes your Java code, combines it with the needed libraries, and starts
the JVM to execute it. The JRE contains libraries and software needed by your Java programs to
run
Java Development Kit:
The Java Development Kit (JDK) is a software development environment used to develop Java
applications and applets
JVM Architecture
(Cont.,)
Class Loader: Class loader is a subsystem of JVM. It is used to load class files. Whenever we run
the java program, class loader loads it first.
Class method area: It is one of the Data Area in JVM, in which Class data will be stored. Static
Variables, Static Blocks, Static Methods, Instance Methods are stored in this area.
Heap: A heap is created when the JVM starts up. It may increase or decrease in size while the
application runs.
Stack: JVM stack is known as a thread stack. It is a data area in the JVM memory which is
created for a single execution thread. The JVM stack of a thread is used by the thread to store
various elements i.e.; local variables, partial results, and data for calling method and returns.
(Cont.,)
Native stack: It subsumes all the native methods used in your application.
Execution Engine:
JIT compiler
Garbage collector
JIT compiler: The Just in Time is a part of the runtime environment. It helps in improving the
performance of Java applications by compiling bytecodes to machine code at run time. The JIT
compiler is enabled by default. When a method is compiled, the JVM calls the compiled code of that
method directly. The JIT compiler compiles the bytecode of that method into machine code,
compiling it “just in time” to run.
Garbage collector: As the name explains that Garbage Collector means to collect the unused
material. Well, in JVM this work is done by Garbage collection. It tracks each and every object
available in the JVM heap space and removes unwanted ones.
Types of Java Applications
-Application Programs
-Applet Programs
Features
- Simple, Object Oriented, and Familiar
- Robust and Secure
- Architecture Neutral and Portable
- High Performance
- Interpreted, Threaded, and Dynamic
Drawbacks
- Slow performance
- Automatic memory management
- Different JVM for different platform
- No support for low-level programming
- Poor features in GUI
Setting Java
- Download the latest version of JDK (Java Development Kit) on your machine
- set environment variable to point to correct installation directory
- An Environment variable is an object on a computer that stores a value(key-value pair), which
can be referenced by one or more software programs in Windows
- Path and Class Path :
PATH is an environment variable which is used to locate JDK binaries like "java" or "javac"
command used to run java program and compile java source file.
CLASSPATH environment variable is used by System or Application ClassLoader to locate and
load compile Java bytecodes stored in .class file
Check- Java installed or not
Stucture of Java Program
Documentation Section
Package Statement
Import Statements
Interface Statement
Class Definition
Main Method Class
Main Method Definition
Sample
public class Hello
{
public static void main(String[] args)
{
System.out.println("Hello Java");
}
}
Points to remember
You have to keep in mind that,
Java code is case sensitive
To write a Java program, you must have to define class first
The name of the class in Java (which holds the main method) is the name of the Java program,
and the same name will be given in the filename
Program Explanation
public class Hello The public word means that it is accessible from any other classes.
/* Comments */ The compiler ignores comment block.
Braces Two curly brackets {...} are used to group all the commands, so it is known that the commands
belong to that class or method.
public static void main •When the main method is declared public, it means that it can also be used by code outside
of its class, due to which the main method is declared public.
•The word static used when we want to access a method without creating its object, as we
call the main method, before creating any class objects.
•main is a method; this is a starting point of a Java program.
String[] args It is an array where each element of it is a string, which has been named as "args". If your Java
program is run through the console, you can pass the input parameter, and main() method
takes it as input.
System.out.println(); This statement is used to print text on the screen as output. All Java statement ends with a
semicolon.
Java Data Types
Tells the compiler what type of variable it as and what type of data it is going to store.
- Data type specifies the size and type of values.
Primary Data Type
Java supports eight primitive data types: byte, short, int, long, float, double, char and boolean.
These eight data types are classified into four groups:
◦ Integer,
◦ Relational Numbers(Floating point)
◦ Characters
◦ Boolean(Conditional).
Non-Primitive Data Types
Classes,Interface, Arrays etc.
(Cont.,)
Type Contains Default Size Range
byte Signed integer 0 8 bit or
1 byte
-27 to 27-1 or
-128 to 127
short Signed integer 0 16 bit or
2 bytes
-215 to 215-1 or
-32,768 to 32767
int Signed integer 0 32 bit or
4 bytes
-231 to 231-1 or
-2147,483,648 to
2147,483,647
long Signed integer 0 64 bit or
8 bytes
-263 to 263-1 or
-
9223,372,036,854,755,8
08 to
9223,372,036,854,755,8
07
(Cont.,)
Type Contains Default Size Range
float IEEE 754 floating
point
single-precision
0.0f 32 bit or
4 bytes
±1.4E-45 to
±3.40282347E+38
F
double IEEE 754 floating
point
double-precision
0.0 64 bit or
8 bytes
±439E-324 to
±1.797693134862
3157E+308
(Contd.,)
Type Contains Default Size Range
char Unicode character
unsigned
u0000 16 bits or
2 bytes
0 to 216-1 or
u0000 to uFFFF
Type Contains Default Size Range
boolean true or false false 1 bit true or false
Java Variables
1. Declaration - eg. int width, height=5;
2. Initialization - static and dynamic initialization
3. Rules of Declaring variables
4. Scope of Variables - limit, as far as the variable can be used
5. Local variables - A variable that is declared within the method
6. Instance variables - A non-static variable that is declared within the class
7. Class/Static variables - A variable that is declared with static keyword in a class
Introduction java programming

Contenu connexe

Tendances

A COMPLETE FILE FOR C++
A COMPLETE FILE FOR C++A COMPLETE FILE FOR C++
A COMPLETE FILE FOR C++
M Hussnain Ali
 
Classes & objects new
Classes & objects newClasses & objects new
Classes & objects new
lykado0dles
 

Tendances (20)

Object oriented programming using c++
Object oriented programming using c++Object oriented programming using c++
Object oriented programming using c++
 
LectureNotes-03-DSA
LectureNotes-03-DSALectureNotes-03-DSA
LectureNotes-03-DSA
 
Java Collections
Java  Collections Java  Collections
Java Collections
 
Io streams
Io streamsIo streams
Io streams
 
Java Tutorial Lab 1
Java Tutorial Lab 1Java Tutorial Lab 1
Java Tutorial Lab 1
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functions
 
Collection framework
Collection frameworkCollection framework
Collection framework
 
Chapter 7 - Defining Your Own Classes - Part II
Chapter 7 - Defining Your Own Classes - Part IIChapter 7 - Defining Your Own Classes - Part II
Chapter 7 - Defining Your Own Classes - Part II
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
 
oop lecture 3
oop lecture 3oop lecture 3
oop lecture 3
 
Machine Learning - Dummy Variable Conversion
Machine Learning - Dummy Variable ConversionMachine Learning - Dummy Variable Conversion
Machine Learning - Dummy Variable Conversion
 
C++ training
C++ training C++ training
C++ training
 
Lecture-05-DSA
Lecture-05-DSALecture-05-DSA
Lecture-05-DSA
 
A COMPLETE FILE FOR C++
A COMPLETE FILE FOR C++A COMPLETE FILE FOR C++
A COMPLETE FILE FOR C++
 
Classes & objects new
Classes & objects newClasses & objects new
Classes & objects new
 
Classes,object and methods java
Classes,object and methods javaClasses,object and methods java
Classes,object and methods java
 
Standard template library
Standard template libraryStandard template library
Standard template library
 
Java Tutorial Lab 2
Java Tutorial Lab 2Java Tutorial Lab 2
Java Tutorial Lab 2
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
 
Object oriented programming in C++
Object oriented programming in C++Object oriented programming in C++
Object oriented programming in C++
 

Similaire à Introduction java programming

Java-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oopsJava-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oops
buvanabala
 
Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016
Manuel Fomitescu
 

Similaire à Introduction java programming (20)

Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
1.introduction to java
1.introduction to java1.introduction to java
1.introduction to java
 
Java-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oopsJava-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oops
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
 
Java1
Java1Java1
Java1
 
Java
Java Java
Java
 
OOP-Chap2.docx
OOP-Chap2.docxOOP-Chap2.docx
OOP-Chap2.docx
 
Unit 1 of java part 2 basic introduction
Unit 1 of java part 2 basic introduction Unit 1 of java part 2 basic introduction
Unit 1 of java part 2 basic introduction
 
Core java
Core java Core java
Core java
 
Core java &collections
Core java &collectionsCore java &collections
Core java &collections
 
Core java1
Core java1Core java1
Core java1
 
CORE JAVA
CORE JAVACORE JAVA
CORE JAVA
 
Java essentials for hadoop
Java essentials for hadoopJava essentials for hadoop
Java essentials for hadoop
 
Java essentials for hadoop
Java essentials for hadoopJava essentials for hadoop
Java essentials for hadoop
 
Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016
 
Basic Java I
Basic Java IBasic Java I
Basic Java I
 
java slides
java slidesjava slides
java slides
 
Java introduction
Java introductionJava introduction
Java introduction
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, Mysuru
 

Dernier

VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 

Dernier (20)

(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 

Introduction java programming

  • 1. INTRODUCTION ON JAVA PROGRAMMING MS. K.NANTHINI ASSISTANT PROFESSOR, KONGU ENGINEERING COLLEGE, ERODE, TAMILNADU,
  • 2. Overview -Programming language and computing platform -first released by Sun Microsystems in 1995 -Java is a simple, general-purpose, object-oriented, robust, secure, architecture-neutral, portable, high-performance, multithreaded computer language -JDK -JRE -JVM write once, run anywhere" (WORA)
  • 3. History -James Gosling from Sun Microsystems and his team began designing the first version of Java aimed at programming home appliances -Name:Oak-Green-Java
  • 4. Java Platform A platform is the hardware or software environment in which a program runs. Popular Platforms : Microsoft Windows, Linux, Solaris OS, and Mac OS - combination of the operating system and underlying hardware But Java is software-only platform that runs on top of other hardware-based platforms -Components
  • 7. Components of Java Architecture Java Virtual Machine: The JVM is a Java platform component that provides an environment for executing Java programs. JVM interprets the byte code into machine code which is executed in the machine in which the Java program runs. Java Runtime Environment: The JRE software builds a runtime environment in which Java programs can be executed. The JRE is the on-disk system that takes your Java code, combines it with the needed libraries, and starts the JVM to execute it. The JRE contains libraries and software needed by your Java programs to run Java Development Kit: The Java Development Kit (JDK) is a software development environment used to develop Java applications and applets
  • 9. (Cont.,) Class Loader: Class loader is a subsystem of JVM. It is used to load class files. Whenever we run the java program, class loader loads it first. Class method area: It is one of the Data Area in JVM, in which Class data will be stored. Static Variables, Static Blocks, Static Methods, Instance Methods are stored in this area. Heap: A heap is created when the JVM starts up. It may increase or decrease in size while the application runs. Stack: JVM stack is known as a thread stack. It is a data area in the JVM memory which is created for a single execution thread. The JVM stack of a thread is used by the thread to store various elements i.e.; local variables, partial results, and data for calling method and returns.
  • 10. (Cont.,) Native stack: It subsumes all the native methods used in your application. Execution Engine: JIT compiler Garbage collector JIT compiler: The Just in Time is a part of the runtime environment. It helps in improving the performance of Java applications by compiling bytecodes to machine code at run time. The JIT compiler is enabled by default. When a method is compiled, the JVM calls the compiled code of that method directly. The JIT compiler compiles the bytecode of that method into machine code, compiling it “just in time” to run. Garbage collector: As the name explains that Garbage Collector means to collect the unused material. Well, in JVM this work is done by Garbage collection. It tracks each and every object available in the JVM heap space and removes unwanted ones.
  • 11. Types of Java Applications -Application Programs -Applet Programs
  • 12. Features - Simple, Object Oriented, and Familiar - Robust and Secure - Architecture Neutral and Portable - High Performance - Interpreted, Threaded, and Dynamic
  • 13. Drawbacks - Slow performance - Automatic memory management - Different JVM for different platform - No support for low-level programming - Poor features in GUI
  • 14. Setting Java - Download the latest version of JDK (Java Development Kit) on your machine - set environment variable to point to correct installation directory - An Environment variable is an object on a computer that stores a value(key-value pair), which can be referenced by one or more software programs in Windows - Path and Class Path : PATH is an environment variable which is used to locate JDK binaries like "java" or "javac" command used to run java program and compile java source file. CLASSPATH environment variable is used by System or Application ClassLoader to locate and load compile Java bytecodes stored in .class file
  • 16. Stucture of Java Program Documentation Section Package Statement Import Statements Interface Statement Class Definition Main Method Class Main Method Definition
  • 17. Sample public class Hello { public static void main(String[] args) { System.out.println("Hello Java"); } }
  • 18. Points to remember You have to keep in mind that, Java code is case sensitive To write a Java program, you must have to define class first The name of the class in Java (which holds the main method) is the name of the Java program, and the same name will be given in the filename
  • 19. Program Explanation public class Hello The public word means that it is accessible from any other classes. /* Comments */ The compiler ignores comment block. Braces Two curly brackets {...} are used to group all the commands, so it is known that the commands belong to that class or method. public static void main •When the main method is declared public, it means that it can also be used by code outside of its class, due to which the main method is declared public. •The word static used when we want to access a method without creating its object, as we call the main method, before creating any class objects. •main is a method; this is a starting point of a Java program. String[] args It is an array where each element of it is a string, which has been named as "args". If your Java program is run through the console, you can pass the input parameter, and main() method takes it as input. System.out.println(); This statement is used to print text on the screen as output. All Java statement ends with a semicolon.
  • 20. Java Data Types Tells the compiler what type of variable it as and what type of data it is going to store. - Data type specifies the size and type of values. Primary Data Type Java supports eight primitive data types: byte, short, int, long, float, double, char and boolean. These eight data types are classified into four groups: ◦ Integer, ◦ Relational Numbers(Floating point) ◦ Characters ◦ Boolean(Conditional). Non-Primitive Data Types Classes,Interface, Arrays etc.
  • 21. (Cont.,) Type Contains Default Size Range byte Signed integer 0 8 bit or 1 byte -27 to 27-1 or -128 to 127 short Signed integer 0 16 bit or 2 bytes -215 to 215-1 or -32,768 to 32767 int Signed integer 0 32 bit or 4 bytes -231 to 231-1 or -2147,483,648 to 2147,483,647 long Signed integer 0 64 bit or 8 bytes -263 to 263-1 or - 9223,372,036,854,755,8 08 to 9223,372,036,854,755,8 07
  • 22. (Cont.,) Type Contains Default Size Range float IEEE 754 floating point single-precision 0.0f 32 bit or 4 bytes ±1.4E-45 to ±3.40282347E+38 F double IEEE 754 floating point double-precision 0.0 64 bit or 8 bytes ±439E-324 to ±1.797693134862 3157E+308
  • 23. (Contd.,) Type Contains Default Size Range char Unicode character unsigned u0000 16 bits or 2 bytes 0 to 216-1 or u0000 to uFFFF Type Contains Default Size Range boolean true or false false 1 bit true or false
  • 24. Java Variables 1. Declaration - eg. int width, height=5; 2. Initialization - static and dynamic initialization 3. Rules of Declaring variables 4. Scope of Variables - limit, as far as the variable can be used 5. Local variables - A variable that is declared within the method 6. Instance variables - A non-static variable that is declared within the class 7. Class/Static variables - A variable that is declared with static keyword in a class