Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
as platform.
o It is a programming
language.
o It is a Computer
Language.
o It is a high level language.
o First appeared in 1995.
o It is originally developed
by James Gosling at Sun
Microsystem.
o Java uses in:
• Electronic Machines.
• Setup box.
• Mother board.
• ECG
PROGRAM
The collection of work in a sequence or step by step.
OR
It is a set of instructions in a sequence, that is called
Program.
CATEGORIES OF JAVA
Flowchart Design
Machine User
Mind mind
ALGORITHM V/S FLOWCHART
1. Start Start
4. Action c=a+b
5. Result Result
6. End End
COMPILATION PROCESS IN JAVA
1. Secure
2. Platform Independent
3. Flexible
4. Robust
FEATURES
5. Portable
OF
JAVA 6. Distributed System
7. WORA (Write Once Run Anywhere)
8. High Performance
9. Reusability
DATATYPE
• It is a state which is used to define or declare the type of variable. It is of two types :-
Datatype
Non -
Primitive
primitive
It is a resource.
It provides java packages &
classes to compile & running
Which is use to compile and run the process.
app.
JAVAC
compiler
Datatype
Contd…
TYPES OF VARIABLE
• LOCAL VARIABLE :- Those variable which are declare within a scope that is called local variable.
• GLOBAL VARIABLE :- Those variable which are declare outside the scope i.e. called global variable.
Note :- We can’t declare class as constant.
OPERATORS
• It is a feature which is use to operate some features like arithmetic, unary, ternary operators and
some other.
STATEMENTS
Having one condition and
if
one statement.
Conditional
Having multiple conditions
nested if
and multiple statements.
Control
Having multiple conditions
Ladder if else and multiple statements but
syntax will be different.
Jumping
Syntax
SYNTAX;
• IF • IF ELSE • NESTED IF • LADDER IF ELSE
IF(CONDITION) IF(CONDITION) IF(CONDITION) IF(CONDITION)
{ { { {
IF(CONDITION) STATEMENT;
STATEMENT; STATEMENT;
{ }
} }
STATEMENT; ELSE
ELSE
}
{ IF(CONDITION)
ELSE
STATEMENT; {
{
} STATEMENT;
STATEMENT;
}
}
ELSE
}
{
ELSE
STATEMENT;
{
}
STATEMENT;
}
QUESTIONS BASED ON CONDITIONAL STATEMENTS...
1) Write a program to find even and odd.
2) Write a program to find vowel and consonant.
3) Write a program to find leap year.
4) Write a program to find who can give the vote and how much age is left for vote.
5) Write a program to print the salary of an employee where salary is equals to 5000 and
condition is
a) If salary is less than 5000 than add Rs.1000.
b) If salary is greater than 5000 then deduct Rs.200.
c) If salary is equals to 5000 then print same salary.
6) Write a program to find how much notes are belongs to the money.
7) Write a program to find greatest number among A, B and C where A=10, B=20, C=30.
CONTD…
8) Write a difference between Object Based Programming and Object Oriented
Programming.
9) Which one is correct?
a) public static void main(String args[])
b) public static void main(String []pra)
c) public static void main(String []args)
d) static public void main(String …p)
e) public static void main(String …pra)
f) public static int main(String args[])
g) static public void main(String args[])
Autoboxing :-
• It is a concept which is use to convert value to the reference variable.
• Value reference variable
autoboxing
Wrapper class :-
• Those classes which are already define in java.lang package.
• Some already define wrapper classes are :-
1. Integer
2. Character
3. Float
4. Double Predefined classes
5. String
6. Object
7. Byte
PROCESS OF OBJECT CREATION IN JAVA
class Test
{
public static void main(String args[])
{
int a;
a=10;
value
}
keyword
Demo d=new Demo();
class Reference
variable constructor
Integer i=new Integer(a);
System.out.println(i);
}
}
AUTOUNBOXING
CONCEPT OF OOPS
1. Class
2. Object
3. Encapsulation
4. Abstraction
5. Data hiding
6. Polymorphism
7. Inheritance
NOTE All points we will discuss one by one.
CLASS OBJECT
z
It is collection of data members and Active part of a class.
member functions. It is a collection of
Real World Entity.
objects.
Instance of a class.
parent
child
MULTI LEVEL INHERITANCE
grandparent
parent
child
• It is a collection of abstract method and variables.
Did u know….???
• This is the solution of Multiple interface.
• Abstract method is a • We can use interface for code reusability.
method which we
only declare. We • Interface always implements into the class.
can’t provide the • Interface - interface always extends like a class.
body of this method,
but we can declare • When we use multiple interface in a single file than one
variable with value. interface must be public.
o SYNTAX
public interface Demo
{ . . . .}
• It is not a class that’s why we do not need to create an
object of interface.
• We always create instance of interface.
INTERFACE • We can call those things by instance which are declared
in interface.
SETTER METHOD
• This method is use to set the value.
• We always have void type of setter method.
• We always provide parameter to setter method.
• setter method always has a user define method.
GETTER METHOD
• It is also a user define method to get value from setter
method.
• We always use return type of getter method as the
parameter of setter method.
• We use return keyword.