0% found this document useful (0 votes)
2K views

Features of Java

Java has several key features: 1. It is simple to code in and supports object-oriented programming concepts like encapsulation, inheritance, polymorphism. 2. It is platform independent as it uses bytecode, allowing programs to run on any system with a Java runtime. 3. It is portable, robust, secure, and supports multithreading, allowing programs to handle multiple tasks simultaneously.

Uploaded by

surbhi mehrotra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Features of Java

Java has several key features: 1. It is simple to code in and supports object-oriented programming concepts like encapsulation, inheritance, polymorphism. 2. It is platform independent as it uses bytecode, allowing programs to run on any system with a Java runtime. 3. It is portable, robust, secure, and supports multithreading, allowing programs to handle multiple tasks simultaneously.

Uploaded by

surbhi mehrotra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Features of JAVA

Features of Java
Features of Java
1. Java is Simple:
Its coding style is very clean and easy to understand.
2. Compiled and Interpreted
Uses both compiler and interpreter to translate the
language to machine code.
3. Platform Independent
This is where the "Write Once, run anywhere" motto for
Java comes in. It means that you can develop on one
environment(Operating System) and run on another
environment without doing any modification of the
Java achieves platform independence by using the
concept of the BYTE code.
Features of Java
4. Portable
Java programs can execute in any environment
(Linux, Window,Mac etc.) for which there is a Java
run-time system (JVM).
5. Architectural Neutral
Java application runs the same bytecodes regardless
of any environment (Operating System).
6. Object-Oriented
Java strongly supports the concepts of Object-
Oriented Programming Java supports major Object-
Oriented programming features like Encapsulation,
Abstraction, Polymorphism and Inheritance.
Features of Java
7. Robust
Robust simply means strong. Its capability to
handle Run-time Error, automatic garbage
collection.
8. Secure
The Java platform is designed with security
features built into the language and runtime
system more secure.
9. Distributed
Java is distributed because it encourages users to
create distributed applications. In Java, we can
split a program into many parts and store these
parts on different computers..
Features of Java
10. Multi Threading:
Java supports Multithreading means handling
more than one job at a time, so get more process
get done in less time than it could with just one
thread.
11. Dynamic and Extensible
Java is dynamic and extensible means with the help
of OOPs, we can add classes and add new methods
to classes, creating new classes through subclasses.
12. High Performance:
Although Java is an interpreted language, it was designed to
support "just-in-time" compilers, which dynamically compile
bytecodes to machine code. Bytecodes are highly optimized, so
Java Virtual Machine can executed them much faster.
Exercise
• Name two types of Java programs.
• Name any four features of Java language.
• Explain Stand alone applications.
• What are Java Applets?
• What is Java Byte code?
• What makes Java language platform
independent? Explain.
• Name the Java compiler and interpreter.
• What is JVM?
• What do you understand by Java library ?
Java Character set
Java Charset
• The character set is a set of alphabets, letters and some
special characters that are valid in Java language. The
smallest unit of Java language is the characters need to
write java tokens. These character set are defined by
Unicode character set.
Alphabets
C abd Java accepts both lowercase and uppercase alphabets as
variables and functions.
Uppercase: A B C ................................... X Y Z Lowercase: a b c
...................................... x y z
Digits
0123456789
Java Character set
Special Characters
+ _ ( ) { } [ ] \ | / > < ; etc.
White Spaces
Tab Or New line Or Space

Escape Sequences
A character preceded by a backslash (\) is an escape
sequence and has special meaning to the compiler. The
following table shows the Java escape sequences:
When an escape sequence is encountered in a print statement,
the compiler interprets it accordingly. For example, if you want to
put quotes within quotes you must use the escape sequence, \",
on the interior quotes
Java Character set
Escape Sequences

Escape
Description
Sequence
\t Insert a tab in the text at this point.
\b Insert a backspace in the text at this point.
\n Insert a newline in the text at this point.
\r Insert a carriage return in the text at this point.
\f Insert a formfeed in the text at this point.

\' Insert a single quote character in the text at this point.

\" Insert a double quote character in the text at this point.


\\ Insert a backslash character in the text at this point.
Data Types in Java
Data types specify the different sizes and values
that can be stored in the variable. There are two
types of data types in Java:
• Primitive data types -
includes byte, short, int, long, float, double, boolean and
char
• Non-primitive data types - such
as String, Arrays and Classes (you will learn more about
these in a later chapter)
Java Primitive Data Types
In Java language, primitive data types are the building
blocks of data manipulation. These are the most basic data
types available in Java language.
There are 8 types of primitive data types:
• boolean data type
• byte data type
• char data type
• short data type
• int data type
• long data type
• float data type
• double data type
Java Primitive Data Types
Data Type Size Description Default Value

byte 1 byte Stores whole numbers from -128 to 127 0

short 2 bytes Stores whole numbers from -32,768 to 32,767 0

int 4 bytes Stores whole numbers from -2,147,483,648 to 0


2,147,483,647
long 8 bytes Stores whole numbers from - 0L
9,223,372,036,854,775,808 to
9,223,372,036,854,775,807
float 4 bytes Stores fractional numbers. Sufficient for storing 6 0.0f
to 7 decimal digits
double 8 bytes Stores fractional numbers. Sufficient for storing 0.0d
15 decimal digits
boolean 1 bit Stores true or false values false

char 2 bytes Stores a single character/letter or ASCII values '\u0000'

You might also like