This document discusses data types and literals in Java. It covers the different primitive and non-primitive data types including numeric (integer, floating point), non-numeric (boolean, char) and reference types (classes, interfaces, arrays). It describes the various integer types (byte, short, int, long), floating point types (float, double), boolean and char types. It also discusses literals and provides examples of numeric, character and string literals in Java.
In the Java programming language, the final keyword is used in several different contexts to define an entity that can only be assigned once. Once a final variable has been assigned, it always contains the same value.
In the Java programming language, the final keyword is used in several different contexts to define an entity that can only be assigned once. Once a final variable has been assigned, it always contains the same value.
its all about java variable.....you may also learn about various data type by this slide. freshers become helpful to read out this.this slides also may helpful in your varsity java course class .in this slide there is vast discussion about java variable
This Presentation is the intro. to java programming.
This presentation contain the basics of Java with example in simple language.
This presentation clear your all concept about programming in java and then you can easily make programs in java.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
3. Recap
In the previous class we have discussed
• White spaces, separators, literals and keywords
• Comments in Java
3
4. Data types in Java
• Data types in Java are classified into
• Primitive types
• Non-primitive types
• Primitive types are also known as simple data
types
• A primitive type is predefined by the language
• Primitive types are further classified into
• Numeric types
• Non-numeric types
4
5. Data types in Java
• Non-primitive types are also known as reference
types
• Non-primitive types are
• Classes
• Interfaces
• Arrays
5
6. The classification of data types in Java
Data types in Java
Primitive Non-primitive
Numeric Non-numeric
classe Arrays
s
integer
char Interface
Floating point Boolea
n
Fig. 6.1 Data types in Java
6
7. Data types
• Primitive Java data types can be grouped into
• integers
• floating point numbers
• characters
• boolean
7
8. Integer types
• Java defines four integer types: byte, short, int and
long
• All these are signed, positive and negative values
• Java does not support unsigned types
• byte is 8 bit width , short is 16 bit width int is 32
bit width and long is 64 bit width
8
9. byte type
• The smallest type is byte
• Range from -128 to +128
• Byte variables are declared by use of keyword
‘byte ‘
eg.
byte x, y;
9
10. short type
• short is a signed 16 bit type.
• Its range is from -32,768 to +32,767
• It is probably the least used data type in Java
• Keyword used is ‘short’
eg.
short x;
10
11. int type
• The most commonly used integer data type is int
• It has a range of -2,147,483,648 to 2,147,483,647
• Keyword used is ‘int’
eg.
int x;
11
12. long type
• long is a signed 64 bit type
• Useful where an int type is not large enough to hold
the desired value
• The range of large is quite large
• This makes it useful when large, whole numbers are
needed
• Keyword used is ‘long’
eg. :
long seconds;
12
13. floating point types
• floating point numbers are also known as real
numbers
• Are used when fractional components are required
• float and double are two kinds of floating point
types
• Keywords used are ‘float’ and ‘double’
13
14. Float type
• float specify a single precision value that uses 32
bits of storage
• float type is useful when you require fractional
component, but does not require a large degree of
precision
eg.
float area;
14
15. double type
• double uses 64 bits of storage
• When you need to maintain accuracy over many
iterative calculations or manipulating large valued
numbers double is the best choice
eg. :
double area;
15
16. character type
• In Java the data type used to store character is char
• char in Java is different from char in C and C++
• Java used Unicode to represent characters
• Unicode was selected because it would help in
internationalization of Java as a programming
language
• Java character is 16 bit type. The range of the
characters is 0 to 65,536
16
17. boolean type
• boolean data type is used to represent logical
values that can be either true or false
• All relational, conditional and logical operators
return boolean values
• It used only one bit of storage
• Keyword used is ‘boolean’
• eg;.
• boolean flag;
17
18. The simple data types in Java
• In summary Java defines eight simple types of
data. They are
• byte
• short
• int
• long
• char
• float
• double
• boolean
18
19. Summary
• In this class we have discussed
• Data types in Java
• Literals in Java
19
20. Quiz
1.Which of the following data type can store only
two values
a) int
b) float
c) boolean
d) All of the above
20
22. Frequently Asked Questions
1. List the different data types available in Java
2. Explain the various data types available in Java
3. List the Literal in Java
4. Explain the Literals in Java
22