0% found this document useful (0 votes)
10 views8 pages

10java Chapter1

java chapter1

Uploaded by

auit.alld
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)
10 views8 pages

10java Chapter1

java chapter1

Uploaded by

auit.alld
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/ 8

ACADEMOPEDIA

Revision of Class IX Syllabus


(i) Introduction to Object Oriented
Programming concepts,
(ii) Elementary Concept of Objects and
Classes
(iii) Values and Data types
(iv) Operators in Java
(v) Input in Java
(vi) Mathematical Library Methods
(vii) Conditional constructs in Java
(viii) Iterative constructs in Java.

Introduction to Object Oriented Programming


concepts,

Principles ( or features) of object oriented programming:


1. Encapsulation
2. Data abstraction
3. Polymorphism
4. Inheritance
Encapsulation:
Wrapping of data and functions together as a single unit is known as
encapsulation.
Data abstraction:
Abstraction refers to the act of representing essential features without
including the back ground details or explanation. Class use the concept of
data abstraction so they are called abstract data type (ADT)

Polymorphism:
Polymorphism comes from the Greek words “poly” and “morphism”. “poly”
means many and “morphism” means form i.e.. many forms. Polymorphism
means the ability to take more than one form.
Function overloading is the way to achieve polymorphism in java program
Example of polymorphism
class p1
{
public void area(int side)
{
int A1=side*side;
}
public void area(double radius)
{
int A2=3.14*radius*radius;
}
public void area(int L , int B)
{
int A3=L*B;
}
}
Inheritance:
Inheritance is the process by which one object can acquire the properties of
another. When the class child, inherits the class parent, the class child is
referred to as derived class (sub class) and the class parent as a base
class (super class).
class cal
{
add() // parent / super class
sub()
}
class cal_1.0 extend cal
{
avg() // child /sub / derived/ base
}

Parameters Java Application Java Applet


Definition Applications are just like a Applets are small Java programs
Java program that can be that are designed to be included
executed independently with the HTML web document.
without using the web They require a Java-enabled web
browser. browser for execution.
main () The application program The applet does not require the
method requires a main() method main() method for its execution
for its execution. instead init() method is required.
Compilation The “javac” command is Applet programs are compiled
used to compile application with the “javac” command and
programs, which are then run using either the
executed using the “java” “appletviewer” command or the
command. web browser.
File access Java application programs Applets don’t have local disk and
have full access to the local network access.
file system and network.
Access level Applications can access all Applets can only access
kinds of resources available browser-specific services. They
on the system. don’t have access to the local
system.
Installation First and foremost, the The Java applet does not need
installation of a Java to be installed beforehand.
application on the local
computer is required.
Execution Applications can execute Applets cannot execute
the programs from the local programs from the local machine.
system.
Program An application program is An applet program is needed to
needed to perform some perform small tasks or part of
tasks directly for the user. them.
Run It cannot run on its own; it It cannot start on its own, but it
needs JRE to execute. can be executed using a Java-
enabled web browser.
Connection Connectivity with other It is unable to connect to other
with servers servers is possible. servers.
Read and It supports the reading and It does not support the reading
Write writing of files on the local and writing of files on the local
Operation computer. computer.
Security Application can access the Executed in a more restricted
system’s data and environment with tighter security.
resources without any They can only use services that
security limitations. are exclusive to their browser.
Restrictions Java applications are self- Applet programs cannot run on
contained and require no their own, necessitating the
additional security because maximum level of security.
they are trusted.

Tokens in Java:
In Java, a program is a collection of classes and methods, while methods
are a collection of various expressions and statements. Tokens in Java are
the small units of code which a Java compiler uses for constructing those
statements and expressions. Java supports 5 types of tokens which are:
1. Keywords
2. Identifiers
3. Literals
4. Operators
5. Special Symbols
1.Keywords

Keywords in Java are predefined or reserved words that have special


meaning to the Java compiler. Each keyword is assigned a special task or
function and cannot be changed by the user.
01. abstract 02. boolean 03. byte 04. break 05. class
06. case 07. catch 08. char 09. continue 10. default
11. do 12. double 13. else 14. extends 15. final
16. finally 17. float 18. for 19. if 20. implements
21. import 22. instanceof 23. int 24. interface 25. long
26. native 27. new 28. package 29. private 30. protected
31. public 32. return 33. short 34. static 35. super
37.
36. switch 38. this 39. throw 40. throws
synchronized
41. transient 42. try 43. void 44. volatile 45. while
46. assert 47. const 48. enum 49. goto 50. strictfp

2.Identifier
Java Identifiers are the user-defined names of variables, methods,
classes, arrays, packages, and interfaces.

There are some standards which you must follow while naming the
identifiers such as:

 Identifiers must begin with a letter, dollar sign or underscore.


 Apart from the first character, an identifier can have any combination
of characters.
 Identifiers in Java are case sensitive.
 Java Identifiers can be of any length.
 Identifier name cannot contain white spaces.
 Any identifier name must not begin with a digit but can contain digits
within.
 Most importantly, keywords can’t be used as identifiers in Java.

3.Literals
Literals in Java are similar to normal variables but their values cannot be
changed once assigned. In other words, literals are constant variables with
fixed values. These are defined by users and can belong to any data type.
Java supports five types of literals which are as follows:

1. Integer
2. Floating Point
3. Character
4. String
5. Boolean

4.Operators
An operator in Java is a special symbol that signifies the compiler to
perform some specific mathematical or non-mathematical operations on
one or more operands. Java supports 6 types of operators. Below I have
listed down all the operators, along with their examples:

Operator Examples
Arithmetic +,–,/,*,%
Unary ++ , – – , !
Assignment = , += , -= , *= , /= , %= , ^=
Relational ==, != , < , >, <= , >=
Logical && , ||
Ternary (Condition) ? (Statement1) : (Statement2);
5.Special Symbols
Special symbols in Java are a few characters which have special meaning
known to Java compiler and cannot be used for any other purpose.

Symbol Description
These are used as an array element reference and also
Brackets []
indicates single and multidimensional subscripts
These indicate a function call along with function
Parentheses()
parameters
Braces{} The opening and ending curly braces indicate the
beginning and end of a block of code having more than
one statement
This helps in separating more than one statement in an
Comma ( , )
expression
Semi-Colon (;) This is used to invoke an initialization list
Asterisk (*) This is used to create a pointer variable in Java

Difference between (POP) and (OOP)

You might also like