Computer Theory
Computer Theory
Computer Theory
Computer Applications
A Method is a block of code that performs a speci c task.
Calling A Function :
Static Function - A function that can be called without creating an object of that
class is called a static function. It can only have Static (class) Variables.
Non Static Function - A function that can be called through the object of that class
is called a Non-Static Function. It can have both Non-Static and Static variables.
Static Variables (Class Variable) - The declaration of the variable includes the
'static' keyword. Only one copy of the variable exists per class. Static variables are
created at the start of program execution and destroyed automatically when
execution ends.
Non-Static Variable (Instance Variable) - The declaration of the variable does not
include the 'static' keyword. They are created when a new object is created and
destroyed when the object is destroyed.
Types Of Methods :
Function Signature - It includes the name of the method and parameter types.
1

fi
fl
fi
fi
fl
Actual Parameters - The Parameters used while calling the function are Actual
Parameters.
Formal Parameters - The Parameters used in the header of the function de nition
are called formal parameters.
Method Overloading - Having more than one method in a single class with the
same name with a di erent argument lists is called function overloading.
Integer it = a;
int it = a;
Pure Function - A function that does not change the state of an object is called a
pure function.
Integer.parseInt() Integer.valueOf()
Escape Sequences - They are used to represent those characters that are either
reserved or not available on keyboard.
2

ff
fi
Eg. String
Compound Statement - More than two statements in {}. Also called a block.
abc();
IDE - Integrated Development Environment. We can edit, compile, debug our code.
Eg. BlueJ
Object Code - Code that can be understood by the Machine. Source code is
converted into Object code.
Compiler - It converts the source code to machine (object) code before execution.
Bytecode - The java compiler compiles the java source code into Bytecode which
makes Java a platform independent language. It is converted by an interpreter
known as Java Virtual Machine (JVM).
3

*Order of Associativity - Left---->RIght
Mixed Mode or Impure Expressions - When operands are of di erent data types.
Fixed mode or pure expressions - When operands are of the same data type.
What is the di erence between the rint() and the round() function in Java?
Math.riot() returns a double type value whereas Math.round() returns an integer type
value.
Eg.
System.out.println(Math.rint(5.5));
System.oui.println(Math.round(5 .5));
Output -
6.0
Class Variables - Instance variables declared with the 'static' modi er.
They are prede ned datatypes that are provided They are derived from the primitive datatypes.
by the language.
4

ff
fi
fi
ff
ff
fi
Wrapper Class - The class equivalent of a primitive data type.
Same as that of the primitive data type but starts with a capital letter.
Java.lang
ch = sc.next().charAt(0);
Matches two consecutive elements matches one element with the rest
A program that translates high level language into machine code is called compiler.
When a class is derived from only one base class, it is known as single inheritance.
When many classes are derived from a class, it is known as hierarchal inheritance
When a class is derived from a class that itself is derived from an other class, it is
known as Multi-level inheritance.
When more than one form of inheritance occurs, it is known as hybrid inheritance.
5