java notes for class x 6
java notes for class x 6
OBJECT An object is an identifiable entity with some Data types are means to identify that type of data and
characteristics & behavior. associated operation of handling it.
Eg. 1 Orange 2 chair 1) primitive (byte, short, int, long, float, double, char,
characteristics boolean)
1. It is spherical shape and color is orange 2) Reference(class, array, interface).
2. It has four legs, back and arms
behavior Type Size Range Initial
1. It is citrus in nature and taste sour. Bits Byte Lowest Highest 0
2. It lets you sit on it byte 8 1 -128 127 0
Object interact with each other by passing message. short 16 2 -32768 32767 0
Basic concept of OOP(object oriented programming) int 32 4 -231 231 -1 0
1.Abstraction refers to the act of representing essential long 64 8 -2 63
263 -1 0
features without including the background details or float 32 4 -3.4E+38 3.4E+38 0.0f
expressions.
double 64 8 -1.7E+308 1.7E+308 0.0d
2. Encapsulation the wrapping of data and functions into a
single unit (class) is known as encapsulation. char 16 2 0 65536 null
3. Inheritance is the capability of one class of things to boolean 8 but uses true false false
inherit capabilities and properties from another class. 1 bit
4. Polymorphism is the ability for a message or data to be all reference type null
processed in more than one form.(function/constructor Reference in java is a data element whose value is an
overloading). address.
The object is implemented in software term as follows.
Scope generally refers to the program region with in which
1. characteristics & Attributes are implemented
a variable/method is accessible. The broad rule is a variable
through member variables or data items of the objects
accessible with in the set of braces it is declared.
2. behaviour is implemented through member function called
Final keyword final while declaring a variable makes it
methods/function.
constant i.e unchanged
Class represents a set of objects that share common
Operators operations are represented by operators and
characteristics & behaviour.
objects(values) of the operation are referred as operands.
A class is an object maker or object factory because it
Unary +, -, ++, —. Binary +, - *, /, % Ternary ?
contains all the statements needed to create an object. Its Relational >, <, ==, >=, <=
attributes as well as statements to describe the operation Logical AND, OR, NOT Bitwise &, |, !, <<, >>
that the object will be able to perform.
Prefix follow first change then use(e.g. ++c) Postfix follow
Source program the program written in high level language
first use then change(e.g. c++)
by programmer is called source code. Shortcuts
Machine code Computer needs source code to be 1. c=c+1 c+=1 2. c=c*4 c*=4
converted into low level language to be executed
3. x=x-10 x-=10 4. x=x/2 x/=2
Byte Code – The JAVA byte code is a machine instruction for a
Importance of main() method : A main()method controls
JAVA processor chip called JVM. The byte code id independent
the execution of all the statements and functions to produce
of a computer system it has to run upon. JAVA programs are
the required output.
compiled and then byte codes are generated.
Import statement : The import statement is used to load
Compiler/Interpreter They both are used for translating
pre- stored instructions into the memory. These instructions
HLL into machine language. Compiler does it at once while
help in executing various instructions, commands and
interpreter does it line by line.
statements given in the program.
Java Virtual Machine is a java interpreter which translates
Example import java.io.*; : It means loading input/output
byte code for specific platforms. instructions used in the program.
Characteristics of java. Expression in java is any valid combination of operators,
1.Write once run anywhere 2.light weight code 3 security constants and variables. It can be pure or mixed. In pure all
4 .built in graphics 5. object oriented language 6.supports the operands are of same data type in mixed they are of
multimedia 7.platform independent 8.open product mixed data type.
Java Character set character set is a set valid characters Type conversion the process of converting one predefined
that a language can recognize(i.e letters, digit,sign etc) type into another is called type conversion.
Unicode java uses Unicode character set. Unicode is a 2 Implicit(coercion) type conversion is performed by java
byte character code set which represents almost all compiler where smaller data type are promoted into higher
characters first 128 are identical two ASCII code. data types.
You refer to a particular Unicode by using \u followed by 4 Explicit type conversion is performed by the user using
digit hexadecimal number type operator.
Tokens the smallest individual unit in a java program is known Block is a group of zero or more statements between
as token. which are keywords, identifiers, literals, balanced braces also known as compound statement.
punctuators, operators. To declare variable that are members of a class the
Keywords are the words that convey a special meaning to declaration must be within the class body.
the language compiler (if , for etc.) Class variable(static) a data member that is declared once
Identifiers are the name given to different parts of program for a class. All objects of the class type share these data
e.g. variables ,objects, class, arrays, function. members as there is single copy them available in memory.
Literals are constant i.e. data item that are fixed values i.e. Instance variable a data member that is created for every
integer, Boolean, character, null, floating, string. object of the class if there are ten objects of a class type
Punctuators separators e.g. () , [], {} there would be 10 copies of instance variable one each for
Operators = ,>, <, = =, : etc. an object.