How many main types of errors occur in Java?
Which of these can be used when a class will be fully abstract?
Predict the output of the following Java code.
Which of these method of FileReader class is used to read characters from a file?
class demo{
public static void main(String args[]){
String first = "Spencer";
first.concat("Gold");
System.out.println(first);
}
}
public class check{
public static void main(String args[]){
int a=10;
int b=20;
int c=10;
int output=0;
output=++a + ++b + ++c ;
System.out.println(output);
}
}
Which of the following is the best practice to measure the time taken by a process for execution?
Which of the following is true about inheritance in Java?
1) Private methods are final.
2) Protected members are accessible within a package and
inherited classes outside the package.
3) Protected methods are final.
4) We cannot override private methods.
Insert the code to make a loop infinite.
class Abekus {
public static void main(String[] args) {
/*write code here*/
for (int i = start; i <= start + 1; i++) {
}
}
}
What will be the output of the program?
try
{
int x = 0;
int y = 5 / x;
}
catch (ArithmeticException ae)
{
System.out.println("Arithmetic Exception");
}
catch (Exception e)
{
System.out.println("Exception");
}
System.out.println("finished");