Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

DR.

APJ ABDUL KALAM TECHNICAL UNIVERSITY

Branch- CSE
Web Technology
Lecture-3

Core Java: Introduction, Operator, Data type


By

Mr. Madhukar
Assistant Professor
Department of Information Technology
Krishna Engineering College, Ghaziabad
History of Java
• Java was originally designed for interactive television, but it was too advanced
technology for the digital cable television industry at the time.
• The history of Java starts with the Green Team. Java team members (also known as
Green Team), initiated this project to develop a language for digital devices such as
set-top boxes, televisions, etc
• The principles for creating Java programming were "Simple, Robust, Portable,
Platform-independent, Secured, High Performance, Multithreaded, Architecture
Neutral, Object-Oriented, Interpreted, and Dynamic“.
• Firstly, it was called "Greentalk" by James Gosling, and the file extension was .gt.
• After that, it was called Oak and was developed as a part of the Green project.
• Java is an island in Indonesia where the first coffee was produced (called Java
coffee). It is a kind of espresso bean. Java name was chosen by James Gosling
while having a cup of coffee nearby his office
Features of Java
There are some excellent features which play an important role in the
popularity of this language. Some are listed below:
• Simple
• Object-Oriented
• Platform independent
• Portable
• Secured
• Robust
• Interpreted
• Multithreaded
• Distributed
Java is object Oriented. Why?
Everything in java is considered as object. Object oriented means software is
recognised as combination of different objects that incorporate both data and
behaviour.
It considers object oriented programming concepts. Basic concepts of OOPs
are:
• Class
• Object
• Inheritance
• Polymorphism
• Abstraction
• Encapsulation
Java is platform independent. Why?
• As other programming language like C, C++, etc. which are compiled into
platform specific machines
• While java is a write once, run on any platform.
• Java code can be executed on multiple platforms, for example, Windows,
Linux, Sun Solaris, Mac/OS, etc. Java code is compiled by the compiler and
converted into bytecode. This bytecode is a platform-independent code
because it can be run on multiple platforms, i.e., Write Once and Run
Anywhere (WORA).
• Java platform(JVM) has two components:
a. Java Runtime environment(JRE).
b. Java API(Application Programming Interface).
Java is secured. How?
• Java is best known for its security. With Java, we can develop virus-free
systems. Java is secured because:
a. No explicit pointer
b. Java Programs run inside a virtual machine sandbox
Operators in Java
• Operator is symbol that is being to perform operations. For example: =,+,/,*
etc.
• Operators in java are given below:
a. Unary Operator- ++,--,~,!
b. Arithmetic Operator-> +,-,%,/,*
c. Shift Operator- <<,>>
d. Relational Operator-<,>,<=,>=,==
e. Bitwise Operator- bitwise OR(|):The bitwise | operator always checks both
conditions whether first condition is true or false. Bitwise AND(&):The
bitwise & operator always checks both conditions whether first condition
is true or false
Operators in java contd.
f. Logical Operator- logical AND(&&):The logical && operator doesn't check
the second condition if the first condition is false. It checks the second
condition only if the first one is true. Logical OR(||): The logical || operator
doesn't check the second condition if the first condition is true. It checks the
second condition only if the first one is false.
g. Ternary Operator-Java Ternary operator is used as one line replacement
for if-then-else statement and used a lot in Java programming. It is the
only conditional operator which takes three operands. (expression)?a:b
h. Assignment Operator- ava assignment operator is one of the most
common operators. It is used to assign the value on its right to the
operand on its left.(=)
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:
• There are two types of datatypes in java:
1. Primitive data types
2. Non-primitive data types

Primitive data types:


• Primitive data types are predefined datatypes. These are building blocks of
data manipulation.
• There are 8 types of primitive data types listed below:
i. Short
Data Types in Java contd.
ii. Int
iii. Long
iv. Float
v. Double
vi. Boolean
vii. Byte
viii. char
Data Types in Java contd.
Non-Primitive data types: These data types are user defined data types.
User defined when there is a need of these data types.
Some are listed below:
i. String
ii. Array
iii. Classes
iv. Interfaces
etc.
Java Keywords
• Java keywords are also known as reserved words. Keywords are particular words that
act as a key to a code. These are predefined words by Java so they cannot be used as a
variable or object name or class name.
• Some keywords are:
abstract
Int
Break
Byte
Class
Continue
Catch
Char
Else
If
Do
Double
Etc.
Thank You

You might also like