Anda di halaman 1dari 12

Subject – Computer Application

Pop is a Procedural Oriented Programming Language. In this, the stress is laid on function rather than data.
Data may be keep floating throughout the Programming .Hence by scanning the whole program from beginning
to the end and we can rectify any error caused.

Drawbacks of POP:-

1) As Data values are global to all the functions, you may require to make necessary changes in the functions
due to change in the data values.

2) It is not suitable to solve complex problems in real situations.

Characteristics of POP:-

1) Emphasis is laid on functions (Logical steps).

2) Functions share global data.

3) Data values can keep floating from one function to another.

4) Uses top down approach of programming.

OOP is an Object Oriented Programming Language. It is a modular approach , which allows the data be applied
within the stipulated program area. It also provides reusability features to develop productivity logic.

Features of OOP:-

1) It gives stress on data rather than function.

2) It makes the program simple by dividing it into a number of objects.

3) The objects can be used as a bridge to have data flow from one function to another.

4) Data can be easily modified without any change in the function.

Basic Elements Or Principles Of OOP:-

Encapsulation-Binding up of data and function together into a single unit called (class) is called Encapsulation.

Data Abstraction-Act of representing only essential features without including its background details is called
Abstraction.

Object-is an identifiable entity with some characteristics and Behaviour.

Class- is a set of objects which share some characteristics and Behaviour.

Attribute:-The characteristics which make every object having its identity make them distinguished is called
attribute.

Polymorphism:-The ability of a method to behave in more than one form is called polymorphism. Function
Overloading is a way to implement it.
Inheritance:- The ability of a class to opt the properties from base or another class is called Inheritance. Extends
is a way to implement it.

Advantages of OOP:-

1) We can extend the use of existing class through inheritance.

2) Using the concept data hiding can generate secured program.

3) We can create different modules in our project through objects.

4) Multiple instances of an object can be generated to co-exist without any interference.

5) It is highly beneficial to solve complex problems.

6) It is easy to modified and maintain software complexity.

Data binding- is the process to link to the function call with function signature at run-time i.e., during execution of
a program.

Data Hiding:-is the data which cannot be accessed directly outside, class premises although they are available in
the same program

Different Types of Programming:-

1) Standalone Application:- An application program that is developed by the user is called standalone
application.

2) Internet Applets:-These are the java programs that are executed in a web browser.

3) Servlets:-They extend the functionality of web browser.

Java Virtual machine is a processor chip that uses byte code as machine instruction and converts it into
machine code.

Byte code is a set of pseudo machine language instructions that are understood by the JVM and are independent
of the underlying hardware.

Application Programming Interface (API):-consists of libraries of pure compiled code that programmers can
use in their application.

Java. Lang:- It is a default class containing String, character, Math, Integer, thread etc. It is a Basic suntime
support.

Basic Features of Java:-

1) Write once run anywhere(WORA)

2) Light Weight code


3) Offers many security features to make its program safe and secure

4) Built in graphics.

5) Supports multimedia

6) Platform Independent

7) Open Product i..e, freely available to all.

Keywords are the reserved words which convey a special meaning to a language compiler.

Comments (Remarks):- refers to statements which are ignored by the java compiler and increase the readability
of a program. These are used to state a purpose of the instructions used in a program.

A token are a smallest individual character used in a java program and is a fundamental unit of a
program. It consists of a keywords, identifiers, operators etc.

Literal (Constant):-are the fixed variables which do not change its values during progam execution.

Operator- are the entities that tells the compiler that what operation has to be perform compiler n given sets of
value.

Data types- are the entities that tell the compiler that which variable will hold what kind of values.

Operands- are the entities that tell the compiler that on which operation has to be perform.

Primitive data types:-Independent of any data type .Also called as Basic Data type. They are pre defined or built
in data types because they are already in java.e,g. byte,int,long,double etc.

Non Primitive Data Types:-Directly or indirectly dependent on primitive data types. They store the data values
with reference to the address or locations. So, they are called as Reference Data Types.

E.g. array, classes interfaces etc.

Variables:-is a named memory location in which we can store our desire data.

Identifiers: - is a series of characters consisting of letters, digits, underscores (_) and dollar signs ($) that does not
begin with digit or special character , should not be a keywords and do not contain any space.

Type conversion:-When an expression holds different types of variables or constant, they are converted to the
same type.

Implicit Data Type:-Such Type of conversion is performed by the compiler without programmer’s intervention. It
occurs when an expression holds different types of variables or constants.

Explicit data type: - Such Type of conversion is user defined conversion which forces an expression to be
converted into specific type.

Expression is a valid combination of variables,constants and operators.

Java Packages for mathematical functions:-

1) Math.sqrt () - find the square root of a positive no.


double n=Math.sqrt (4.0);

2) Math.min ()-returns minimum of two numbers.

3) Math.max ()-returns maximum of two numbers.

4) Math.pow ()-returns power raised to specified no.

5) Math.log ()-always returns a double data type. And returns natural logarithmic values.

double x=Math.log(6.25) x=1.8325

7) Math. abs ()-convert -ve magnitude to +ve magnitude.

8) Math,round()-returns the value in rounded form. Always returns an int data type. If the fractional part of the
number is below 0.5 it returns a number down to the nearest integer otherwise returns the next integer
value.

9) Math.floor()-it returns a number don to a nearest integer. and always returns a double data type.

10) Math.ceil()-provided the rounded value to a next higher integer. returns a double data type.

11) Math.rint()-remove the fractional part only.

Import is a pre defined keyword by which we can include all pre defined classes, packages and function in a
program.

Exception refers to any contradictory or unusual situation which can be encountered during a progam execution.

Exception handling is ideal for:-

1) Processing exceptional situations.

2) Processing exceptions for components which cannot handle them directly.

3) Processing exceptions for widely used components that should not process their own exceptions.

4) Large Projects that requires uniform error processing.

Advantages of exception handling:-

1) It separates error handling code from the normal code.

2) It enhances the readability.

3) It makes clear and rodest (Strong) Program.

Stream Is a flow of data in the form of bytes and provides capabilities of processing all types of data.

Packages are group of related classes and interfaced and provides a convenient mechanism for managing a large
sets of classes and interfaces and avoiding naming conflicts.
FUNCTIONS
Static Data members is an instant variable which is global in the class and commonly by all the objects of that
class type.

Static member method is a member method which uses only static data members or static instant variable.

Method is a specific implementation of an operation by a certain class.

Function Prototype is the first line of the function definition.

Function Signature refers to the name of function and different types of arguments (parameters)in the function
prototype.

Return is a java keyword used as the last statement of the method if it returns a valid java data type.

Actual Parameters are parameters specified while calling the method whose value is passed to the method.

Formal parameters are parameters which are specified in the function prototype.

Pure function is that function which returns values and do not change their state.

Impure function is that function which may returns values but change their state.It is also known as Modifier
functions.

Void keyword indicates that the function does not return any values.

Function overloading means when more than one functions have same name but the types and number of the
arguments are different .

A method is given a private access if its scope is to be limited to the class in which it is defined. The other classes
will not be able to invoke the private method of other classes.

Main() is the first method that gets called in a java class (progam).The keywords static makes the java
interpreter call main method without the need of creating any object .

All non-static methods can be called only by writing object name and method name separated by a
dot.

If a method or member variable is preceeded by protected access specifier, the scope of the member is the
class itself (where it is declared) and its sub-class i.e., these members can be inherited unlike the private
members.

POINTS TO BE REMEMBERED WHILE USING STATIC:-

1) Static methods can only call other static methods without associated with objects.

2) Static methods can only access other static data without associated with objects
Pass by value is the process of passing a copy of actual arguments to the formal parameters. Any change
made in the formal parameters does not reflect on the actual arguments.

Pass by Reference is the process of passing the reference (address) of actual arguments to the formal
parameters. Any change made in the formal parameters reflect on the actual arguments.

Three Types of Functions In java:-

1) Computational Functions that calculate or compute some value and return calculated value.

2) Manipulative functions that manipulate information and return success or failure code.

3) Procedural functions that perform an action and return no value.

Function overloading helps in avoiding the use of if-else statements to decide which function should
be called in which context as in case of overloading functions the compiler automatically takes the
decision, based upon the parameters used to call the functions.

In java only objects and arrays can be passed by Reference.

Statement specifically called that invokes a function—Function call.

Another name for creating an objects—Time.

A Package which java uses by default—Java.lang.

A keyword applied to include a package—Import

Hypothetical name of Java—OAK

CONSTRUCTORS
Constructor is that unit of a class which is used to initialize the data members.

Characteristics of Constructor:-

1) Same name as class.

2) Does not return type even void.

3) Used to initialize data members of an object with legal initial values.

4) Called or invoked when an object of a class is created.

5) Cannot be called explicitly.

6) By default , the constructor gets public

7) Non Parameterized do not accept any argument and initialize data members by legal initial
value.
8) Parameterized accept argument and initialize data members by value of the arguments
passed.

Constructor overloading:-Defining more than one constructor or a class with different number for type of
parameters passed to a constructor.

Destructor is a member method that gets invoked when the object scopes ends. The memory allocated to objects
by the constructors gets deallocated when a destructor gets invoked automatically. A destructor’s name is same
as that of a class name. A destructor does not return any value not even void. A class can have only one destructor.

Temporary objects gets created when a constructor is called explicitly.

In java, the new operator allocates the memory for the objects during the run-time of a program. The
memory occupied by these objects is deallocated when no references to the objects exist. This
memory can be reclaimed. In java, this deallocation is performed automatically and is called the
garbage collection feature.

A Default constructor is invoked by default by the system. It initializes the instant variable of an object with
defined values.

A Copy Constructor initializes the instant variables of an object by copying the initial values of the instant
variables from another object.

A Parameterized Constructor is a member function with same name as that class name which is used initializes
the object variables by passing parametric values at the time of its creation.

General Glossary

1) Base class – It is a class which is inherited to another class.

2) Break Statement-It is a statement, which is used to terminate the program, when the condition is
satisfied.

3) Buffer –is a high speed temporary storage, which is also known as cache memory

4) Character-It is a token which is a distinctive mark or symbol, alphabets (small or capital ) or digits.

5) Compiler-The software which converts high level language instructions to machine level language at
once.

6) Compound Statement-Is a set of multiple statement written within braces {}is called a compound
statement.

7) Continue Statement-is a statement which is used to go for the next iteration, when the condition is
satisfied within the program.

8) Debugging-is the process of correcting errors which occurs during the compilation of the program.

9) Dynamic Binding is the process of linking the function call with the function signature during the
execution if the program.
10) Instant Variables –A variable defined within the class or object.

11) Scope of variable-It is a parameter of variables within which they can be applied in a program.

12) Reusability-The process of adding some additional features to a class without modifying its
contents.

13) Message-is a way of sending\receiving information to\from objects.

14) Object factory-A producer of objects that accepts some basic information and creates objects on
based on this information.

15) Final –It is a keyword which before variable make it constant. (imp.)

16) Dot (.)operator-accesses instance members of an object or class members of a class.

17) Block- It is a group of zero or more statements between balanced braces and can be used anywhere
a single statement is allowed.

18) Static- It is a keyword which in the variable declaration make it class variable.

19) New-It is a keyword which allocates the memory and instantiate an object.

20) Type Promotion-Conversion of all operands upto all the type of the largest operands.

21) Integral Promotion- -Conversion of shorter integral types into bigger integral types.

22) Java shorthand-A way of combining an arithmetic operator and an assignment operator.

23) This-It is a keyword (which is actually a reference) sorting the address of the objects currently
invoking a member functions.

24) Accessor method-It is a method that returns the value of a data-member of the class.It is actually
for Private members.

25) A Setter method-(Mutator method) –It is a method that sets \changes the value of a data-
member of the class.It is actually for Private members.

26) Exception Handling-Way of handling anomalous situations in a program-run.

27) Try and catch- Try contains a block of statements to perform any error occurring within the try
block is trapped. Further a report is passed to the exception handler about the error, which is done by
the catch block.

28) Super –It is a keyword used in inheritance for calling base class constructor.

29) Throws-It is a keyword used to inform that an error has occurred. It is specified with method
prototype.

30) Syntax Error-Programming language’s grammar rules violation error.

31) Compile time error-Error that the compile can find during compilation.

32) Run Time Error-Error during program execution.


33) Dangling else Problem-The nested if –else statement introduces a source of potential ambiguity
reffered to as dangling else problem. This problem arises when in a nested if statement, number of ifs is more
than the number of else clauses. The question arises, with which if does the additional else clause property
match-up.

34) Fall-through- The misuse or missing of break statement leads to fall of control.

35) Global Variable-class variable which is available to entire class.

36) Local variable-Variable declared inside a method or block.

37) Scope-Region within which a variable\piece-of-code is accessible.

38) Selection Statement-Statement that allows to choose a set-of-Instruction for execution depending
upon an expression.

39) Statement-Instruction given to the computer to perform any kind of action.

40) Infinite loop-A loop that never ends.

41) Iteration statement-Statements that allows a set of instructions to be performed repeatedly.

42) Jump Statement-Statement that unconditionally transfers program within a function.

43) Looping Statement-Iteration Statement. Also called a loop.

44) Nested Loop-A loop that contains another loop inside its body.

45) Piece-of-code (Variable’s scope)-The program part(s) in which a particular piece-of code or a data
value (e.g., variable) can be accessed.

46) Data members-that contain information necessary to represent the class.

47) Sequential construct-The Statements in a program are executed sequentially one after the other
from to the last statement.

48) Non- Static variables- It can be accessed in static members by associating them with object separated
by a dot.

49) Continue Statement-This statement changes the flow of execution to stop the sequential execution
and resume the condition check.

50) Library class-Pre defined classes of java which get included in an application program itself. They are
also known as Standard java classes or built-in-java classes.

51) Byte stream classes- They are built up to provide the functionality of reading and writing bytes. They
help in transmitting data (bytes) in one direction. They are thus useful in Input-Output operation.

52) Character stream classes- It support Input-Output operation on characters.

53) Reader class- is a Character stream classes i.e., it is used to read characters from source.

54) Interface- is a set of variables and methods like a class.


55) Abstract methods-All methods in an interface are abstract i.e., their body needs to be defined in a
class that implement the interface.

56) Subscripts are cell numbers of the array &subscript variable is the variable used along with
cell no. E.g., m[4] 4 =Subscript m= subscript variable.

57) Buffered reader- It buffers the input and improves the performance.

58) Field-An individual data item of a record.

59) Record-It is a set of related information.

60) Binary file-store information in a form of bytes.

61) Coercion-Implicit data type conversion is termed as coercion in which the data gets converted to its
higher type without any intervention of user.

62) Parameter- The variable used with method signature which received value during function call.

63) Arguments-The values which are passed to the method during its call from the caller.

64) Object source- The conversion of High Level Language to Machine Level Language with the help of a
translator.

65) Source code-An application program written High Level Language, which is an input to a computer
system.

66) Static initialization- When a variable is initialized with a specific constant before its use in the
operation.

67) Testing-It is the process of checking program logic manually to ensure whether it contains any error or
not.

68) Normal flow of control- When a command to execute a program is issued, control keeps on moving
sequentially from one statement to other from beginning to an end in order to execute them is known as
normal flow of control.

69) String Buffer-It is a type of memory location, which allows reasonable space to contain a string in such
a way that any change brought affects the same string.

70) Multilevel Inheritance- A target which inherits a base can be used as a base for another target.

71) Class members declared to be protected are treated as private members for the existing
class but can be inherited to another class.

72) Truncation- IT rounds off by removing fractional value.

GIVE REASONS

1) Class is an object factory.

Ans:-It contains all the statements needed to create an object, its attributes as well as the statements to describe
the operations that object will able to perform.
2) An object as an instance of class.

Ans:-Data members of a class are also referred as Instance variables. These Instance variables are embedded
automatically within an object at the time of its object creation.

3) Class is a user-defined data type.

Ans:-A class is a construct that binds one or more primitive types together to be used as a single data types. It is
designed by the programmer and thus, it is called user defined data types.

4) Objects encapsulate state (attributes) and behavior (functions).

Ans:-Every object has its own attributes and function. Nokia cellphone has its characteristics of memory ,no of
tones ,it is its attributes and has functions like send and receives call ,games etc.

5) Java- A purely Object oriented language.

Ans:-The programs written in this language are closer to the objects that are effected by the program. In java,
even a simple program to display a message needs to be a class defined in which a method are written.

6) Java- A case sensitive language.

Ans:-It treats upper case and lower case differently.

7) Java is called internet language.

Ans: - It concentrates on the real word objects and is portable which demand by World Wide Web.

8) Java- A garbage collector.

Ans: - In java, the new operator allocates the memory for the objects during the run time of a program. The
memory occupied by these objects is deallocated when no reference to the objects exist. In java, this deallocation
is performed automatically.

9) An object’s state and behavior are two distinct things yet linked to one another.

Ans: - The state of an object controls its behavior of an object can bring about a change in its state.

10) Encapsulation is one of the major properties of OOP.

Ans: -Encapsulation is a way to implement data abstraction. Encapsulation hides the details of the implementation
of an object.

11) Only a function that has access to the constructor can use the objects of this class.

Ans: - Since, every time an object is created, it is automatically initialized by the constructor of a class.

12) There can be many abstractions of an object.

Ans: - Abstractions of an object or an entity depends upon the application it is to be used.

13) Java is also known as platform.

Ans: - Platform is the environment in which programs execute instead of interaction with the OS directly, java
program run on a virtual machine provided by java.

14) Classes are said to be associated of or a set of objects.


Ans: - Classes are named groups of related characteristics and behavior exhibited by a set of similar objects.

15) JVM is referred as machine although it is software.

Ans: -JVM being software produces machine readable code from byte code. Hence, it is referred as machine.

Type Size Range

Byte 8 bits (1 bytes) -128 to +127

Short 16 bits(2 bytes) -32768 to +32768

31 31

Int 32 bits (4bytes) -2 to 2 -1

63 63

Long 64 bits (8bytes) -2 to 2 -1

Float 32 bits (4bytes) -3.4E+38 to +3.4+38

Double 64 bits (8bytes) -1.7E +308 to 1.7E+308

Four items that are needed to define a class

1) Public 2) Class 3) Classname 4) Instant variable.

Two non numeric primitive data type :- Char and String.

Steps involved in debugging

Error detection and Error correction.

A data type starts with lower case letters and its wrapper class begin with upper case letters.

String type allocates fixed length in the memory but the string buffer type allocates memory with
length by the user. Accessor Method is also known as pure function. Mutator Method is also known
as impure function.

Anda mungkin juga menyukai