0% found this document useful (0 votes)
2 views44 pages

JAVA

The document provides a comprehensive overview of Java programming concepts, including primitive and reference data types, operators, conditionals, loops, and jump statements. It also covers object-oriented programming principles such as methods, constructors, inheritance, and polymorphism. Additionally, it includes practical coding examples and notes on syntax and usage.

Uploaded by

sbc24042006
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)
2 views44 pages

JAVA

The document provides a comprehensive overview of Java programming concepts, including primitive and reference data types, operators, conditionals, loops, and jump statements. It also covers object-oriented programming principles such as methods, constructors, inheritance, and polymorphism. Additionally, it includes practical coding examples and notes on syntax and usage.

Uploaded by

sbc24042006
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
You are on page 1/ 44

JAVA

1)Hello world program

2)Primitive datatypes-whole numbers


3)Primitive datatype-Boolean

4)Primitive datatype-Decimal

5)Primitive datatype-char and symbols


6)Primitive datatype-no changes
reflected

7)Reference datatype-changes
reflected
8)Arithmetic operators

9)Relational operators
10)Logical operators
11)Unary operators-post fix-increment
and decrement
12)Unary operators-pre fix-increment
and decrement
13)typecasting(explicit)

14)Ternary operator with ?


15)Conditional-if else

16)Conditional-if,else if and else


17)Nested if

18)Switching-alternative for
conditionals
19)Looping-for loop

20)Looping-while loop
21)Nested loops

22)Do while loop


23)Jump statements-break

24)Jump statements-continue
25)Find max from user input

Swapping without temp variable


Extra codes
1)BMI CALCULATION

2)Shopping cart

3)user input
4)Swapping based on user input
5)area of triangle

6)display date
7)Factorial

8)Leap year
*)Note:nextline cannot be used
immediately after nextint,nextfloat or
next long as \n remains in input
buffer,consume using ob.nextLine
9)Finding greatest number using
ternary operator

10)Fibonacci-similar to swap
PART1(basics-conquest)

1)Arrays(1d)
2)2d array

3)matrix using 2d array

PART2:-(oops)
1)method or fn def and calling without
parameters and void

2) method or fn def and calling with


parameters and void

3)non void without parameter


4)non void with parameter
5)Recursive

6)Class and objects without


parameters and with function call

7)Class and objects with parameter


8)Private method with error
9)Private variable or identifier with
error
10)Setter fn-to access private in
another class
11)2 classes-rename file based on
which class to run
NOTE:Only 1 class can be run at a time
but that class should have main
function and file should be named as
that class to run it
Syntax for creating object
class ob=new class();

12)Constructors with default values


13)Constructor with values assigned to
variables

14)Parameterised constructors
Note:-
diff between method and constructor
 Method can have any name-can be void or non void
 Constructor can only have name of class
 Method can be explicitly called by user any number of
times
 Constructor is implicitly called while using the
object(automatically called when object is made not by
user)

Types of constructor-default and


parameterized
-default just creates object
-parameterized accepts parameters
15)Inheritance using extends keyword
16)Inheritance using extends keyword
working

The class dog has inherited from


animal class
17)Inheritance with multiple fns

18)Polymorphism-one method many


forms
19)Polymorphism with methods with
varying parameters-2 and 3

20)Polymorphism-code to find min of


array
21)Inheritance-method overriding
#field value is updated to 7(overrided)
#So value given in subclass is only considered not
main class
#even methods can be similarly updated
#parent class,base class or super class-class from
which it is inherited
#class which inherits is called subclass or side class
##method or field overloading-polymorphism
Same name but diff forms(signature)
#method or field overriding-inheritance
Same name in parent and subclass-uses subclass
updated value

22)Types of inheritance

You might also like