Page 9 - computer science (868) class 11
P. 9
values – variables denoting objects are references to those objects. The assignment operator = is special.
The variable on the LHS of = denotes the memory location while the same variable on the RHS denotes the
contents of the location e.g. i=i+2.
Note: Library functions for solving expressions may be used as and when required.
7. Statements, Scope
Statements; conditional (if, if else, if else if, switch case) ternary operator, looping (for, while, do while),
continue, break; grouping statements in blocks, scope and visibility of variables.
Describe the semantics of the conditional and looping statements in detail. Evaluation of the condition in
conditional statements.
Nesting of blocks. Variables with block scope, method scope, class scope. Visibility rules when variables
with the same name are defined in different scopes.
8. Methods and Constructors
Methods and Constructors (as abstractions for complex user defined operations on objects), methods as
mechanisms for side effects; formal arguments and actual arguments in methods; different behaviour of
primitive and object arguments. Static methods and variables. The this operator. Examples of algorithmic
problem solving using methods (number problems, finding roots of algebraic equations etc.).
Methods are like complex operations where the object is implicitly the first argument. Operator this denotes
the current object. Methods typically return values. Illustrate the difference between primitive values and
object values as arguments (changes made inside methods persist after the call for object values). Static
definitions as class variables and class methods visible and shared by all instances. Need for static methods
and variables. Introduce the main method – needed to begin execution. Constructor as a special kind of
method; the new operator; multiple constructors with different argument structures; constructor returns
a reference to the object.
9. Arrays, Strings
Structured data types – arrays (single and multi- dimensional), strings. Example algorithms that use
structured data types (searching, finding maximum/minimum, sorting techniques, solving systems of
linear equations, substring, concatenation, length, access to char in string, etc.).
Storing many data elements of the same type requires structured data types – like arrays. Access in arrays
is constant time and does not depend on the number of elements. Sorting techniques (bubble, selection,
insertion), Structured data types can be defined by classes – String. Introduce the Java library String
class and the basic operations on strings (accessing individual characters, various substring operations,
concatenation, replacement, index of operations).
SECTION C
10. Basic input/output
Basic input/output using Scanner
Input/output exceptions. Tokens in an input stream, concept of whitespace, extracting tokens from an input
stream (String Tokenizer class). The Scanner class can be used for input of various types of data (e.g. int,

