0% found this document useful (0 votes)
46 views5 pages

Java Notes

The document discusses the history and features of the Java programming language. It was developed in 1991 by James Gosling at Sun Microsystems and was initially called Oak. Key features include being simple, secure, object-oriented, portable, robust, multithreaded, and dynamic.

Uploaded by

bot khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views5 pages

Java Notes

The document discusses the history and features of the Java programming language. It was developed in 1991 by James Gosling at Sun Microsystems and was initially called Oak. Key features include being simple, secure, object-oriented, portable, robust, multithreaded, and dynamic.

Uploaded by

bot khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

 History of java:

Java was developed at Sun Microsystems in 1991. The java was invented by James Gosling. The
language was initially called oak, it was later termed as java.

 Features of java:

1.Simple: java is a simple language. There are various concepts that makes the java as a simple
language. Java is designed to be easy to learn. Programs in java are easy to write and debug
because java does not use the pointers, preprocessor header files.

2.Secure: Java is aimed to be used in networked or distributed environment. Java does not
allocate direct pointer to memory, this makes it impossible to accidentally reference memory
that belongs to other program.

3.Object-oriented: Java is an object-oriented programming language. Everything in Java is


an object. Object-oriented means we organize our software as a combination of different
types of objects that incorporate both data and behavior.

Basic concepts of OOPs are:

1. Object
2. Class
3. Inheritance
4. Polymorphism
5. Abstraction
6. Encapsulation

4.Portable: Java is portable because it facilitates you to carry the Java bytecode to any platform.
It doesn't require any implementation.

5.Robust: The English mining of Robust is strong. Java is robust because:

o It uses strong memory management.


o There is a lack of pointers that avoids security problems.
o Java provides automatic garbage collection which runs on the Java Virtual
Machine to get rid of objects which are not being used by a Java application
anymore.
6.Multithreaded: A thread is like a separate program, executing concurrently. We can
write Java programs that deal with many tasks at once by defining multiple threads. The
main advantage of multi-threading is that it doesn't occupy memory for each thread. It
shares a common memory area. Threads are important for multi-media, Web
applications, etc.

7.Dynamic: Java is a dynamic language. It supports the dynamic loading of classes. It means
classes are loaded on demand. It also supports functions from its native languages, i.e., C and
C++.

 Concept of java: Java is a class-based, simple programing language, object-oriented,


and secure programming language developed by James Gosling at Sun Microsystems,
Inc. in 1991. Java is compiled into the bytecode and then it is interpreted to machine
code.
 JDK: Java Development Kit= collection of tools used for developing and running Java
programs.
 JRE: java runtime environment = helps in executing programs developed in java.

 Data types in Java: A computer has to process various types of data. Data types specify the
different sizes and values that can be stored in the variable. There are two types of data
types in Java:
1. Primitive data types: The primitive data types include boolean,
char, byte, short, int, long, float and double.
i. Byte: The byte data type is an example of primitive data type. It isan 8-bit
signed two's complement integer. Its value-range lies between -128 to 127
(inclusive). Its minimum value is -128 and maximum value is 127. Its default
value is 0.
ii. Short: The short data type is a 16-bit signed two's complement integer. Its
value-range lies between -32,768 to 32,767 (inclusive). Its minimum value is -
32,768 and maximum value is 32,767. Its default value is 0.
iii. Long: The long data type is a 64-bit two's complement integer. Its value-range
lies between -9,223,372,036,854,775,808(-2^63) to
9,223,372,036,854,775,807(2^63 -1)(inclusive). Its minimum value is -
9,223,372,036,854,775,808and maximum value is 9,223,372,036,854,775,807
iv. Float: The float data type is a single-precision 32-bit IEEE 754 floating point.Its
value range is unlimited. It is recommended to use a float (instead of double) if
you need to save memory in large arrays of floating point numbers. The float
data type should never be used for precise values, such as currency. Its default
value is 0.0F.
v. Double: The double data type is a double-precision 64-bit IEEE 754 floating
point. Its value range is unlimited. The double data type is generally used for
decimal values just like float.
vi. Boolean: The Boolean data type is used to store only two possible values: true
and false. This data type is used for simple flags that track true/false conditions.
vii. Char: The char data type is a single 16-bit Unicode character. Its value-range
lies between '\u0000' (or 0) to '\uffff' (or 65,535 inclusive).The char data type is
used to store characters.

 Variables: A variables is a container that stores a value. This value can be


changed during the execution of the program. They are also the identifier of the
memory location.
Rules for declaring a variable name, we can choose a name while declaring a
java variable if the following rules are followed:
1.Must not begin with a digit.
2. Name is case sensitive.
3. Should not be a keyword
4. White space not allowed.
5. Variables name must begin with either a letter or the dollar sign “$”, or the
underscore character “_”.

 Expression: In any programming language, if we want to perform any


calculation or to frame any condition etc., we use a set of symbols to perform the
task. These set of symbols makes an expression. In the java programming
language, an expression is defined as follows.

 Operators: in Java is a symbol that is used to perform operations. For example:


+, -, *, / etc.
I. Unary
II. Arithmetic
III. Bitwise
IV. Logical
V. Ternary

 Constant: Constant is a value that cannot be changed after assigning it. Java does not
directly support the constants. There is an alternative way to define the constants in Java
by using the non-access modifiers static and final.

I. Integer Constants
II. Real constants
III. Character constants
IV. String constants

 Array:  is an object which contains elements of a similar data type. Additionally, The
elements of an array are stored in a contiguous memory location. It is a data structure
where we store similar elements. We can store only a fixed set of elements in a Java
array.

Types of Array in java:

o Single Dimensional Array


o Multidimensional Array

You might also like