0% found this document useful (0 votes)
7 views

Computer Java Definitions (Class-Ix) (2023) (File-1)

Uploaded by

lahiri8919
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Computer Java Definitions (Class-Ix) (2023) (File-1)

Uploaded by

lahiri8919
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Computer Application, Class-IX(FILE-1) 2023

Java Fundamentals (Ch-1)


Introduction
Definition of computer software:
➢ Software may be defined as a set of instructions stored or saved as programs in computer’s memory for
the execution of any particula task or operation. Software is intangible.
➢ A set of instructions that perform a particular task is called a software program.
➢ The instructions in the program direct the computer to perform input operations, process the data and
output the results.
Computer Programming Language:
➢ Programmers make use of a computer programming language to communicate with the computer.
➢ By the help of programming language, we can instruct the computer to execute the given task properly
and efficiently.
➢ A programming language consists of all symbols, characters and uses rules that permit programmer or
user to communicate with the computer.
 Computer languages can be broadly classified into two types:

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 Oriented Programming (OOPs)


Definition :
 It is a very powerful programming concept.
 It supports modular approach, which allows the data to be applied within the stipulated program area.
 It also provides reusability features to develop productivity logic, which means to give more emphasis
on data rather than functions.

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

O.O.P. provides following facilities:


 It gives emphasis on the data items rather than functions.
 It makes the program very simple by dividing it into several objects.
 Objects can be used as a bridge to have data flow from one function to another.
 We can easily modify data without disturbing/manipulating structure of the function(s).

Basic elements /principles of OOPs :


 Objects
 Classes
 Data abstraction
 Encapsulation
 Inheritance
 Polymorphism
 Data hiding
 Dynamic Binding

❖ Objects : It is an identifiable entity with some characteristics and behaviour.


❖ Class :
✓ A class can be defined as a group of objects which possess same characteristics and
behaviour.
✓ Class is known as object factory, because objects are created from a class.
✓ An object is known as instance of a class.
❖ Encapsulation : Binding up of data and function together into a single unit (class) is called
Encapsulation.
❖ Data Abstraction : Act of representing only essential features without including its background
details is called Abstraction.
2
❖ Attribute : Attributes/Characteristics of any object are useful to set its unique identity & make object
distinguished.
❖ Polymorphism: The ability of a method to behave in more than one form is called polymorphism.
(e.g. Function Overloading is a way to implement it.)
❖ Inheritance: The ability to extend or inherit properties of a class to another class is called Inheritance.
(*Extensibility & Reusability are two special features Inheritance.)

❖ 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)

Java Programming Language


 Java is an example of general OOP language developed by Sun microsystems of U.S.A. in the year 1991.
 It is also an example of H.L.L.
 Java programming language was developed primarily by James Gosling and his colleagues at Sun
microsystems. The language was initially called Oak.

Basic Features of Java:


 Example of OOP.
 Java programs are both compiled and interpreted.
 Robust and Secure
 Multithreaded and interactive
 Platform independent and portable
 Supports dynamic and extensible features
 Case sensitive programming language

“Buzz Words” of Java:


✓ Simple
✓ Secure
✓ Portable
✓ Object oriented
✓ Robust
✓ Multithreaded
✓ Architecture neutral
✓ Interpreted
✓ High performance
✓ Distributed
✓ Dynamic

Different Types of Java Programming:


Java mainly supports two types of programming:
 Stand Alone System (Java application programs): A java program which is developed by the user
is termed as a java application.

 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)

• Written by user Byte Code


• Machine • Object/executable
dependent code
• Compiled code
• Machine
• ext. is .Java • Machine
Dependent
independent
Source Code • ext. is .class
Machine Code
Compiler (javac)

✓ The extension name of Java source code file is .Java


✓ Java is an example of purely case-sensitive programming language.
✓ In java we can develop internet oriented software. It means program based on networking.
✓ The compiled code of Java, source code is called Byte code and its extension is .class.
✓ Java is an example of portable programming language. Java ensures portability in two ways:
 In Java the compiler generates Byte code instructions that can be implemented in any machine.
 The sizes of primitive data types are machine-independent.
✓ Java environment includes a large number of development tools and hundreds of classes and methods.
The development is part of the system known as Java Development Kit (JDK) and the classes and
methods are part of a system known as Java Standard Library (JSL) also known as Application
Programming Interface (API).

API

Packages

Classes & Interfaces

Methods & Constants

 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.*;)

Note : Java is called a robust programming language:


Reason : Java supports to detect the errors or any mistakes present in any program at
the early stage of program development. It enforces this feature by providing
automatic memory management and exception handling mechanism.
Elements of Java Programming:
 Character Set: In Java programming, we need character set to write source codes and to perform
some specific actions during execution of program.
Java supports two types of character sets:
a) Source character set:
Characters under this category are used to write source code or program
code in Java. e.g. A-Z, a-z, 0-9, {, ; ,+ etc.
b) Execution character set:
 These characters are used to shift the cursor from one position to
another during execution of programs.
 In short we can say that, when we want to shift the pointer from
one position to another place to display the output in a specific
format we need the help of execution character set.
 It is also known as Escape Sequence. e.g. \n,\t,\b,\f,\r ,\v etc.

 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.

There are three ways to give a comment in Java programming:


a. Single line comment. (//)
b. Multi-line/Block comment. (/*………*/)
c. Documenting comment. (/**…………..
…………………*/)

 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’;

 We can set initialization under two categories:

➢ Static Initialization: It is a process to initialize a variable during its declaration.


➢ Dynamic initialization: It is a process to initialize a variable during execution of program
logic. It means to assign a value to a variable by solving any
arithmetic or logical function during execution of program is
known as dynamic initialization.
c. Literals: Literals are the constants in Java programs mainly available in expressions with a direct fixed
value (Also Known as Nameless Constants).

We can set literals under the following categories:

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)

v. Boolean literals: They can be represented by true or false.


vi. Null literals: This is a special purpose literal which is represented as ‘\0’.

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.

 Semicolon (;) is used to terminate a statement so it is called statement terminator.


 Dot (.) is used to separate a function from object. It is also used to separate a class name
and a method. e.g. Math.pow(3,2);

 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.

 ( ) - Braces – It is used to write an expression.


 { } – Curly braces – It is used to enclose a group of statements.
( Special NOTE: Statements written inside curly braces are called compound statements )
 [ ] – Square bracket– It is used to declare an array.
 , - Comma – In Java program, comma is used as a variable separator.

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

5) Increment and Decrement operators

6) Unary and Binary operators

7) Ternary or conditional operator

8) Bitwise operators

9) Compound assignment operators

10) Special operators (Misc. Operators)

*********

You might also like