AmbitionBox
Discover Best Places to work in India
Discover best places to work
Compare & find best workplace
Bring your workplace to life
Highlight your company's perks
Read reviews for 6L+ companies
Rate your former or current company
Discover salaries for 8L+ companies
Calculate your take home salary
Check your market value
Help other jobseekers
Read interviews for 90K+ companies
Interviews questions for 1K+ colleges
Contribute your interview questions
Java Programming
The width in bits of double primitive type in Java is --.
The width of double is platform dependent
128
64
8
Which of the following is true regarding source code file ?
A. It can have more than one public class
B. It can have more than one non public class and one public class
C. It cannot have non public class
D. None of the above
What is true regarding the following code in Student.Java ?
public class Student{ }
public class ABC { }
A. Compilation error
B. Runtime error
C. No error
Source code file can have only one public class.
Consider the following code fragment:
1. package RobotDrivers ;
2. import robots.*;
3. public class RobotPlayer extends FunnyRobot {
4. static int i =5;
5. public static void main(String[] args){
6. i = 6;
7. RobotPlayer rp = new RobotPlayer();
8. rp.dance();
9. }
10. }
Which of the following statements is true about this code fragment?
A. The code will compile and execute correctly and generate the output: The funny robot is dancing!.
B. There would be a compiler error at line 7 because the method dance() is protected and the classes RobotPlayer and FunnyRobot are in different packages.
C. There would be a compiler error at line 6.
D. The code will compile but generate a runtime exception.
1. class MyClass {
2. public void message (int i) {
3. public int j= i;
4. System.out.println("Value of j: " + j);
5. }
6. public static void main(String[] args) {
7. MyClass ma = new MyClass();
8. ma.message(15);
Which of the following statements is true about this code?
A. The code will compile and execute fine, and the output will be Value of j: 15
B. Line 2 will generate a compiler error.
C. The code will compile but will give an error at execution time.
Which of the following statements is true?
A. The final variable may only be used with a variable or a method.
B. The final variable may not be copied to a file during object serialization.
C. The final method may not be overridden.
D. The class that has a final method may not be extended.
Which of the following statements is true about the static modifier?
A. A static variable cannot change its value.
B. A static method cannot be overridden to be non-static.
C. A static method is often overridden in a non-Java language and exists outside of JVM.
D. The static code lies outside of any class.
1. class MySuperClass {
2. static void message() {
3. System.out.println("From the super class!");
4. }
6. public class MySubClass extends MySuperClass {
7. void message() {
8. System.out.println("From the subclass!");
10. public static void main(String args[]) {
11. MySubClass mysub = new MySubClass(); 12. mysub.message();
13. }
14. }
Which of the following modifiers placed in the beginning of line 7 will make the code compile and execute without error?
A. Static
B. Public
C. Protected
D. Transient
Assume that a variable exists in a class and that the variable must not be copied into a file when the object corresponding to this class is serialized. What modifier should be used in the declaration of this variable?
A. Private
B. Protected
C. Native
Join India’s largest community to research company culture
Are you a student or working professional?
Student/Never worked
I am a student/I have never worked
Working Professional
I am working/I have worked before
What are your preferred job locations?
Popular Cities
Other Cities
Follow your preferred designations/job profiles
Suggestions based on your job profile
vs
Similar Companies