Computer Java Definitions (Class-Ix) (2023) (File-1)
Computer Java Definitions (Class-Ix) (2023) (File-1)
Machine level
Low Level
Programming Assembly level
Language
High level
*No need to write definitions given inside this box in yourcomputer copy (This is only for your knowledge)
Machine level Language: This is the only language that a computer can understand. In this language all the instructions
are coded in terms of 0’s and 1’s. To avoid difficulties in using the machine language, a symbolic language called assembly
level language was developed. In this language with 0’s and 1’s, we can also use symbolic codes such as ADD, SUB,
MULT, DIV etc. to denote various operations such as addition, subtraction, multiplication, division respectively.[These
codes are called mnemonic codes]. Assembler converts assembly level language to machine level language.
High Level Language: The instructions written in high level language are easy to learn and use because the instructions
and statements written in HLL resemble ordinary statements in English and are very easy to understand. HLLs are machine
independent. A program written in one machine can be run on another machine.]
P.O.P: (Procedural Oriented Programming). In this type of programming concept many instructions are written to carry
out any task. These instructions are grouped together to perform functions (modules). In this programming concept we
want to give emphasis on the functions rather than data items.
Drawbacks of P.O.P:
• In P.O.P concept, data values are global to all the functions. You may require making necessary changes in the
functions due to any change in data values.
• Not suitable to solve complex problems in real situations.
Characteristics of P.O.P:
• Emphasis is on functions. [logical steps]
• Functions share global data.
• Data values can keep floating from one function to another.
• Uses top-down approach of programming.
1
• Interpreter: An interpreter is a program or set of instructions which translates programs from HLL into
machine language, line by line, and vice versa. ( * It displays error step wise)
• Compiler: It is a collection of instructions or programs mainly to convert HLL instructions into machine
language at once, and vice versa.
Object: An object is an example of real world entity with a list of attributes or properties.
➢ Three special attributes of an object:
✓ Identifier
✓ State
✓ Behaviour
❖ Dynamic binding : It is a process to link to the function call with function signature at run-time.
(i.e. during execution of a program.)
❖ Data Hiding : By this concept we can make member(s) of class not accessible directly from outside.
(* Beyond premises/scope of the class)
Applets: The java programs which are downloaded from the net and can be applicable to the user’s
requirements are called Internet applets or Java applets.
3
* In Java we can also develop programs for server computers called servlets and package to define classes
and their methods.
✓ Coding Concept in Java:
In Java program we need both compiler and interpreter to run a program (source code).
❖ Some Important Notes:
Interpreter (JVM)
API
Packages
JDK: JDK comes with a collection of tools that are used to develop and execute Java programs.
➢ Applet Viewer : Supports to run Applets.
➢ javac(compiler) Source code Byte Code
➢ java.exe (interpreter) Byte code Machine Code
➢ javadoc : To create help files
4
➢ javap (Dissembler) Byte Code Source Code
➢ jdb (debugger)Which helps us to find errors in our programs
In Java, to import a library package to a program we need to import keywords.(e.g.: import java.io.*;)
Comments:
These are the non-executable statements, specified in source code. By writing comments
we can provide, some useful guidelines for the users. It is also known as remark.
Tokens:
In Java programming token is the smallest unit of a program. In other words, we can say
each individual character used in Java program is termed as a token. It is the fundamental
unit of a Java. Java mainly supports following types of tokens:
a. Keywords
b. Identifiers
c. Literals
d. Punctuators
e. Operators
a. Keywords: These are pre-defined or pre-compiled words available with the software.
By the help of keywords, we can perform various tasks in our program very easily
without writing their definitions. The definitions of the keywords are available in
Java library class files.
5
✓ All the keywords are always in lower-case.
✓ Execution speed of keywords is very fast because they are pre-compiled.
✓ We cannot change the definitions of the keywords.
✓ Keywords are also known as reserved words
b. Identifiers: In Java program, we need identifiers to set name or represent variables, objects, classes,
methods and arrays. By specifying identifiers, we can guide compiler to locate the
element in memory or to identify the element for its execution.
Rules for naming a variable(or set Identifier):
✓ It may contain alphabets, digits, _ and $.
✓ It must start with an alphabet including _ and $
✓ Blank spaces are not allowed.
✓ Keywords are not allowed.
✓ It is purely case-sensitive.
✓ The name must be short and meaningful.
Some important Notes:
✓ Variables: These are the elements available in program to store values. By declaring
a variable, we can occupy a fixed memory space to store data of different
types. The value of a variable is changeable. (It means we can change the
value a of variable during execution of a program)
Note: In Java, to declare a variable we need data types. e.g. int, float, double, char etc.
✓ Constant: These are the items available in a program to hold a fixed value. It means, we
cannot change the value of a constant. (In Java final keyword is used to
declare a constant.)
✓ Declaration: It is a process to introduce a variable to the compiler without any initial value.
e.g. int x; double b; char ch;
✓ Assignment: It is a process to store or assign a value to a declared value.
e.g. x=90; b=95.5; ch= ‘A’;
✓ Initialization: It is the combination of declaration and assignment i.e. to give a value to a variable
during the time of its declaration.
e.g. int x=100; double b=90.5; char ch=‘d’;
i. Integer literals: The numbers which are represented without decimal points. e.g.1, 2, 3, 4…..
ii. Real literals: These are numbers with decimal or fraction parts. e.g. 1.5, 2.8, 7.98 etc.
6
iii. Character literals:Under this category we can use all characters. e.g. a-z, A-Z, 0-9, symbols etc.
iv. String literals: It is a set of alpha-numeric characters and symbols enclosed within a pair of
double quotes. e.g. “apple12”, “abcdefg”, “!A”, “” (null string-length zero)
d. Punctuators: These are the symbols that we need in our source code to perform any specific action
or to represent any specific element. Some punctuators are ?, ; , . etc.
Separator is a part of punctuator and these special characters are used in Java programs
to perform special and very useful actions. These are also known as delimiters.
OPERATORS/OPCODES
These are symbolic instructions/special character(s), which are used in Java programs to perform different
types of arithmetical and logical operations on data items (operands)
We can divide all the Java operators into the following groups:
1) Arithmetic operators
2) Relational operators
3) Logical operators
4) Assignment operator
8) Bitwise operators
*********