100% found this document useful (2 votes)
396 views

Data Types PPT

Uploaded by

2311cs050086
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
396 views

Data Types PPT

Uploaded by

2311cs050086
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Java Data Types

 Java programming language has a rich set of data


types. The data type is a category of data stored in
variables. In java, data types are classified into two
types and they are as follows.
 Primitive Data Types
 Non-primitive Data Types
 A data type defines the type or/and behavior of a data, it
tells to the compiler about the type of data which is
going to be stored and the compiler reserves the fixed
number of bytes for that particular variable/constant.

Department of CSE
 Thus, we can say that, a data type defines two things:
 Type of data
 Memory blocks to be reserved for the data
 There are mainly two data types in Java
 Primitive data types
 Non-primitive data types

Department of CSE
Department of CSE
Java Primitive Data Types:

Department of CSE
Java Comments:
 Comments are not a part of the compiled program. They
can be used to explain Java code, and to make it more
readable. It can also be used to prevent execution when
testing alternative code.
 Single-line Comments: It starts with two forward slashes
(//).
 Any text between // and the end of the line is ignored by
Java (will not be executed).

 2. Java Multi-line Comments: It starts with /* and ends


with */.
 Any text between /* and */ will be ignored by Java.
Department of CSE
Understanding First Java Program:
 Let's see what is the meaning of class, public, static, void,
main, String[], System.out.println().
 class keyword is used to declare a class in java.
 public keyword is an access modifier which represents
visibility, it means it is visible to all.
 static is a keyword, if we declare any method as static, it is
known as static method. The core advantage of static
method is that there is no need to create object to invoke
the static method.
Department of CSE

You might also like