Академический Документы
Профессиональный Документы
Культура Документы
2018 (d) How are private members of a class different from public members?
ans
(d) public members can be accessed from any other class.
private members can only be accessed within the declared class.
(d)
Write the prototype of a function check which takes an integer as an argument and
returns a character.
ans
d)
char check (int n)
2018 (d) Write two characteristics of a constructor.
ans
(d)
(i) Constructors have the same name as that of the class they belong to.
(ii) Constructors are executed when an object is created.
2018 (e) Write the output for the following:
System.out.println("Incredible"+"\n"+"world");
ans
(e)
Incredible
world
2019 (e) State a difference between call by value and call by reference
Call by value Call by reference
It works with primitive data type It works with reference data type
The original value of variable remains The original value of variable changes
unchanged
Operation is performed on duplicate value of Operation is performed on original values of
variables variables.
It is also called as pure function It is also called as Impure function.
2019 (j) What is meant by a package? Give an example.
ans
(j) Package in Java is a mechanism to encapsulate a group of classes, sub packages and interfaces
Example: java.lang
java.util
java.io