Sunday, November 4, 2018

JAVA Theory Part-9

String Functions




String – String is a series of character which includes spaces also. String is a class not a data type.

1.         length();
Syntax- int length();
Usage- This function returns the length of characters present in the string.

2.         charAt();
Syntax- char charAt(int n);
Usage- This function returns nth character of the string.

3.         toUpperCase();
Syntax- String toUpperCase();
Usage- This function/method is to convert all the character of the string into uppercase.

4.         toLowerCase();
Syntax- String toLowerCase();
Usage- This function/method is to convert all the     characters of the string into lowercase.

5.         replace();
Syntax- String replace(char ch1,char ch2);
Ch1- character to be replaced.
Ch2- character by which to be replaced.
Usage- This function replaces all the occurrences of the character ch1 with ch2 in the string.

6.         trim();
Syntax- String trim();
Usage- This function is used to remove all the white spaces at the beginning and end of the string.

7.         equals();
Syntax- boolean equals(String2);
Example-s1.equals(s2);
Usage- This function gives true if s1 equals to s2.

8.         concat():
Syntax- String concat(String2);
Example-s1.concat(String s2);
Usage- This function concatenates s1 equal to s2.

9.         substring();
Syntax- String substring(int n);
Usage-This function returns substring starting from the nth character of the string.

10.       substring();[another format]
Syntax- String substring(m,n);
Usage-This function returns substring starting from mth character upto the nth character without including the nth character.

11.       indexOf();
Syntax for string- int indexof(String str);
Syntax for character- int indexOf(char ch);
Usage-This returns the position of the first occurrence of the character or string in the string.

12.       indexOf()(another format)
Syntax- int indexOf(String str, int start index)
int indexOf(char ch , int start index)
Example- int indexOf(“the”,n);
int indexOf(‘y’,n);
This format gives the position of “the” and ‘y’ starting from the nth position in String.

13.       compareTo();
Syntax- int compareTo(string str);
Example-s.compareTo(s1);
Usage-This function returns negative if s is less than s1, positive if s is greater than s1 and zero if s is equal to s1.
This compares two string lexicographically.

14. boolean endsWith(String str)
Usage- Tests if the this string (current Stringobject) ends with the specified suffix (str).

15. int lastIndexOf(char ch)
Usage-returns the index within the this string of the last occurrence of the specified character.

16.       stringreplace(string s1, string s2)

Usage-It replace string s1 with string s2.

JAVA Theory Part-8

DEFINITIONS(Part-8)




Multilevel Inheritance: A target which inherits a Base class can, in turn, be used as a Base for another target. Such System is known as Multilevel or Nested Inheritance.

Hybrid Inheritance:  When more than one type of Inheritance Systems is used together, it is known as Hybrid Inheritance.

WORA: Write Once Run Anywhere. It is a special feature of java which makes it java platform independent. If a Program is written once, it can run on any platform.

Keyword new: It is used to create a new object or a new array. It creates a memory for the variable or object.

Keyword this: It is the reference to the current object.

Keyword extends: It is used to inherit a subclass to the superclass.

Type Promotion (or) Implicit Conversion:  The Java compiler converts all operands up to the type of the largest operand. This type of Conversion is known as type promotion or implicit conversion.

Intrinsic data types: These are the primitive data types. They are independent of themselves. Ex: int, float, byte, char, double, etc.

Output Stream: System maintains a flow of characters from the processor to the VDU known as Output Stream.

Syntax Error (or) Sematic Error:  Error resulting when the grammar rules or the grammar of the programming language are not followed.

Logical Error:  It is an error in planning the program’s logic. There may be no errors while compiling but the result or outcome will not be correct.

Runtime Error: These are mistakes other than the syntax and logical error which come during the time of execution.

Conditional Statement: A statement which works on the given condition in the expression is known as Condition Statement.

Index: It is the position of the character in a given string. The numbering of characters generally starts from 0.

Exit Control Loop: This loop checks the given test condition at the end of the loop structure. It checks the condition after executing the body of the loop.

Entry Control Loop: This loop checks the condition and executes the loop only if the condition is true i.e., It checks the condition at the entry of the loop.

NaN: -Not a Number. When a negative number is given in Math.sqrt() function. It results NaN.

Infinity: When a number is divided by zero(0). It results in infinity.


Absurd Value: When a variable is not initialized with a value. It stores an absurd value in the space given for the variable in Compiler Allotment Phase.

JAVA Theory Part-7

DEFINITIONS(Part-7)




Impure Function: This function may or may not return a value but it changes the state of an object.

Function Overloading: It is the process of defining functions with the same function names but with the different number and types of parameters.

Static Binding (or) Early Binding: The System finds the best match of function arguments and parameter list during program compilation. This phenomenon is known as Static Binding or Early binding.

Recursive Function: A function designed in such a way that it calls itself in its body is known as Recursive Function.

Parameters: Parameters are the list of variables which are defined in the function definition or function call.

Arguments: Arguments are the values passed to the actual parameters bypass by value or pass by reference due to its invoking.

Boolean Search:  It is a type of searching in which Boolean variable is used to check if the given value is present in the array elements or not. Example Prg: Boolean search.

Nested Class: A nested class mean a class within a class.

External Wrapper: External Wrapper is the class declaration enclosing inner part within a pair of curly brackets.

Visibility Modes: Visibility modes are the Access Specifiers. They deal with the scope of usage of the function. They are public, private, protected.

Scope of Variable: It determines the visibility of an instance variable throughout the class. It shows the usage of the variable in the program.

Referencing member methods: The process of referring the member methods from the main class through class objects.

Nested member method: A method within a method is known as a nested member method.

Invoking a constructor: The process of using a constructor in the program is known as Invoking a Constructor.

Default Constructor: A constructor which initializes instant variables of an object with definite values readily defined is known as Default Constructor.

Parameterized Constructor: It is a member function with the same name as the class name which is used to initialize the object variable by passing parametric values at the time of its execution.

Copy Constructor:  This Constructor is used to copy the initial values of the instant variables of an object to the instant variables of another object.

Constructor Overloading: It is the process of defining constructors with the same function names but with the different type of parameters.

Base Class (or) Super Class:  A class from which another class inherits.

Derived Class (or) Sub Class: A class inheriting properties from another class.

Single Inheritance: If a Base class is derived by a single target, then it is known as Single Inheritance.

Multiple Inheritance: When a subclass inherits from multiple Base classes is known as multiple Inheritance.


Hierarchical Inheritance: When many Targets inherit from a single base class, it is known as Hierarchical Inheritance.

JAVA Theory Part-6

DEFINITIONS(Part-6)




Test Condition:  Each loop contains a test condition. It determines whether the loop has to be repeated or terminated.

Linear Search: It is the simplest way of searching a value. Every element of the array is checked with the value given by the user until the last element. It starts from the 0th position of the array.

Binary Search: Binary Search takes place only on sorted data items where the array is divided into halves and the value is checked in the desired half.

Bubble Sort: In this method, many iterations takes place during each iteration pairs of consecutive elements are compared and arranged according to the order.

Selection Sort:  In this method, Successive rounds are executed to select the elements in some order and place them in their positions.

Single Dimensional array: When the elements of an array are specified by a single Subscript, the array is called the subscripted variable or single dimensional array.

Scanner class: It is available in System package java.util. It is used to enter values from the user from the console during the execution of the program.

Delimiter: It is a special character used to take out tokens using Scanner class.

Constructor: It is a member function with name same that of the class name used to initialize the values of instant variables.

Invoking: The process of using a method in the function in the program in called Invoking a method.

Module: It is a program segment.

Function prototype: The function prototype is the first line of the function definition that tells the program about the type of the value returned by the function and the number and types of arguments.

Function Signature: Function signature basically refers to the number and types of arguments, it is the part of the prototype.

Function Header: It is the first line of a method. It contains parameters list, return type, access specifier, and method name.

Parameter list: It is a list of parameters which are called during its invoking.

Access Specifier: It gives the publicity modes of the method. It can be either public or private or protected.

Return Statement: The statement which sends value from method to caller program is known as Return statement.

Actual Parameter:  The parameter that appears in the function call statement is called the actual parameter.

Formal Parameter: The parameter that appears in function definition are called formal parameter.

Pass by Value (or) Call by Value: Pass by value is the process of passing a copy of actual parameters to the formal Parameters.

Pass by reference (or) Call by Reference: It is the process of passing the reference of actual parameters to the formal parameters.


Pure Function (or) Accessor: It is a Function which returns a value to the caller module. It does not change the state of an object.

JAVA Theory Part-5

DEFINITIONS(Part-5)



Increment Operator: Increment operator increases the value of operand by one.

Decrement Operator: Decrement operator decreases the value of operand by one.

Erythematic Operator: An Operator which performs arithmetic functions is known as Erythematic Operator.

Logical Operator: These Operator yield results in 0 and 1 depending upon the outcome of the result. They check between two variables or values.

Relational Operators: Operators which are used to show or check relationship between operands are known as relational operators.

Precedence of operators: Specific order in which the operators in an expression are evaluated when the expression has several.

Bitwise Operator: The Bitwise operators calculate each bit of their result by comparing the corresponding bits of the two operands. (a) The AND operator & (b) The OR operator |(c) The XOR operator ^ (d) The compliment operator ~.

Compound Statement: It is a block of code containing more than one executable statement. In Java the { } is called block and the statements written under {} is called compound statements or block statement. The { } opening and closing braces indicates the start and end of a compound statement.

Mathematical Functions: The methods which perform mathematical calculations and which are included in a package of java. This package is automatically imported into the class.

Return Type: It is the data type used before the method name in the method header that indicates the type of the outcome value.

Return value: It is the value that returned to the caller when the function is invoked.

Variables: A variable is a stored memory location .It is used to store different constant values.

Label: Default and case keywords are known as labels.

Fall through: The unusual execution of more than one cases at a time is known as fall through. This occurs when the case is not applied between two or more cases. The control executes to the next case also for execution.

Statement Terminator: Semicolon is the statement terminator in Java. It indicates the end of a statement.

Case Terminator:  Break keyword is used as case terminator. Break does not allow the control to execute on to the next case. It indicates the end of the case.

Jump statement: Break and Continue are the two jumping statements. Break terminates the execution of the loop or program. Continue skips the execution of one iteration of a loop.

Testing: Testing is the process in which the program is validated by checking all the specifications desired.

Debugging: Removal of errors in the program is known as Debugging.

Iteration: Process of repeating mathematical or computing process or set of instructions again and again each time applying it to the previous stage is called Iteration.

Loop: Set of instructions that are repeated again and again until a particular condition is satisfied.


Control Variable: A variable, which starts with an initial value and determines the duration of repetition is known as Control variable.

JAVA Theory Part 4

DEFINITIONS(Part-4)



Punctuators: Punctuation signs are used in the program as special characters to terminate or for reference, etc. Ex: (.), (;).

Data Type: Data types are built in java to differentiate between the types of data taken as input from the user. So data types are defined already to differ all the type of data.

Primitive Data Types (or) Composite Data Types: The data types which are independent of any other type are known as Primitive data types. (Basic data types).

Non Primitive Data types (or) Reference Data Types: These are derived data types. They are directly or indirectly independent on Primitive data types.

ASCII: Each character in Java, are given (assigned to) an ASCII code. These codes are taken into consideration during java programming.

Identifiers: Identifiers are the variables in the Java Program. A variable is a named memory location.

Dynamic Initialization: When a method or functions is called and the return value is initialized to a variable is called dynamic initialization.

Static Initialization: This process uses the direct assignment of a variable constant. The variable is initialized during its declaration.

Assignment: Storing constants to variables using token ‘=’. So, ’=’ is called Assignment operator.

Erythematic Expression: It contains variables, constants and arithmetical operators together to produce a meaningful result.

Pure Expression: An arithmetic Expression which contains the same type of data items.

Mixed Expression: An expression which includes different types of variables or values which yield a result.

Expression: A Set of variables or values which yield a result.

Type Conversion: The process of converting one predefined type into another is called Type Conversion.

Type Casting: The explicit conversion of an operand to a specific type is called typecasting. The operator that converts its operand to a specified type is called the typecast operator.

Explicit Conversion: an explicit type conversion is user defined that forces an expression to be of the specific type.

Coercion: An implicit type conversion is a conversion performed by the compiler. The Java compiler converts all operands up to the type of the largest operand. This is also known as type promotion.

Operator: A symbol or a token which performs arithmetical or logical operations and yields a result.

Operand: An operator acts on different data items/entities called operands.
Statement: An expression which is assigned to a variable is completely known as the statement.

Unary Operator: An arithmetical operator which is applied with a single operand is known as the Unary operator.

Binary Operator: An arithmetic operator which deals with two operands, is known as Binary Operator.

Ternary Operator (or) Conditional Assignment Operator: Ternary operator deals with three operands. The value assigned to a variable depends upon a logical expression.

Prefix: When increment or decrement operators are applied before the operant, it is known as prefix operators.


Postfix: When increment or decrement operators are applied after the operant, it is known as prefix operators.

JAVA Theory Part-3

DEFINITIONS(Part-3)



Stream: It is the flow of Characters maintained by the System. Characters flow from either input devices or processors to the Standard Output Device (VDU).

Exception: An Exception is an unexpected situation that occurs during the execution of the program. It may be due to improper use of input resources or overflow situation.

Error: An error is an improper situation, misuse of terms, undesired result giver, grammatical error in the program.

Exception Handling: Overcoming an exception is known as Exception handling. In Java Programming generally, it is done with Try-Catch keywords.

Wrapper Class: Wrapper class is used to create objects for the values of primitive data types. It wraps the primitive data type values into an object. It also provides conversion between character/string to other primitive types.

Data Member: The state or characteristics of an object are considered to be as a Data member.

Member method: The behavior and functions of an object are considered to be the Member methods.

Static Data member: It is an instance variable which is global in the class and used commonly by all the objects of that class.

Static member Method: It is a member method which uses only static data members or static instant variables.

Package: A Package is a set of classes. Which carry out a certain task. They are imported into the program.

User Defined Package: A User can create a package to use them in the program logic. A package may be defined by the users to be used in various program logic. These are known as user-defined packages.

Input Stream: An Input Stream contains functions related to input/output operations. It allows the user to enter the value from the console at the time of execution.

Buffer: It is a high-speed temporary memory storage which is applied between I/O devices and processor to synchronize their speeds.

Array:  An array is a structure created in the memory to represent a number of the same type of data using the only single variable.

Subscripted variable: When the elements of an array are specified by a single Subscript, the array is called the subscripted variable.

Subscript: Each Individual element of an array is termed as Subscript.

JDK: Java Development Kit contains various libraries that can be used in the program. It is needed to run or write a Java Program.

JRE: Java Runtime Environment.

Tokens: Each individual and functional unit of a Java Program is considered as Tokens.

Literals: Literals are the constants in the Java Program. Their Value remains fixed throughout the program.

Escape Sequences: These are the non-Graphic Characters which are used to control the cursor while printing. Ex: \n – new line, \t – horizontal tab.


Separators: These are the special characters in Java, used to separate or enclose different variables or characters. Ex: (.), (,) (), [], {}.

Sample Paper - Class 10th