Premium

Oracle Java Programming Certification Questions and Answers (Dumps and Practice Questions)



Question : Given:
class X {}
class Y { Y ( ) { } }
class Z { Z (int i ) { } }
Which class has a default constructor ?

 : Given:
1. X only

2. Y only

3. Z only

4. X and Y
E. Y and Z
5. Y and Z

Correct Answer : Get Lastest Questions and Answer :
Explanation:






Question : The protected modifier on a Field declaration within a public class means that the field .
 : The protected modifier on a Field declaration within a public class means that the field .
1. Cannot be modified
2. Can be read but not written from outside the class
3. Can be read and written from this class and its subclasses only within the same package
4. Can be read and written from this class and its subclasses defined in any package




Correct Answer : Get Lastest Questions and Answer :

Explanation:






Question : You have been given below code

public class DoBreak1 {
public static void main(String[] args) {
String[] table = { "aa", "bb", "cc", "dd" };
for (String ss : table) {
if ("bb".equals(ss)) {
continue;
}
System.out.println(ss);
if ("cc".equals(ss)) {
break;
}
}
}
}

What would be printed ?

 : You have been given below code
1. aa cc
2. aa bb cc
3. cc dd
4. cc

5. Compilation fails.



Correct Answer : Get Lastest Questions and Answer :
Explanation:






Related Questions


Question : Identify two benefits of using ArrayList over array in software development.
A. reduces memory footprint
B. implements the Collection API
C. is multithread safe
D. dynamically resizes based on the number of elements in the list



 : Identify two benefits of using ArrayList over array in software development.
1. A,B
2. A,D
3. Access Mostly Uused Products by 50000+ Subscribers
4. C,D





Question : You have been given below code


Public Class Test {}

Which two packages are automatically imported into the java source file by the java compiler?s

A. Java.lang
B. Java.awt
C. Java.util
D. Javax.net
E. Java.*
F. The package with no name


  :  You have been given below code
1. A,B
2. A,F
3. Access Mostly Uused Products by 50000+ Subscribers
4. C,D
5. E,F






Question : Which is a valid abstract class?

 : Which is a valid abstract class?
1. public abstract class Car { protected void accelerate();}
2. public interface Car {protected abstract void accelerate();}
3. Access Mostly Uused Products by 50000+ Subscribers
4. public abstract class Car { protected abstract void accelerate();}

5. public abstract class Car { protected abstract void accelerate() { //more car can do}}






Question : Which three statements are true about the structure of a Java class?
A. A class can have only one private constructor.
B. A method can have the same name as a field.
C. A class can have overloaded static methods.
D. A public class must have a main method.
E. The methods are mandatory components of a class.
F. The fields need not be initialized before use.

 : Which three statements are true about the structure of a Java class?
1. A,B,C
2. B,C,D
3. Access Mostly Uused Products by 50000+ Subscribers
4. D,E,F

5. A,E,F






Question : Which two items can legally be contained within a java class declaration?
A. An import statement
B. A field declaration
C. A package declaration
D. A method declaration

 : Which two items can legally be contained within a java class declaration?
1. A,B
2. B,C
3. Access Mostly Uused Products by 50000+ Subscribers
4. B,D

5. A,D






Question : Which two may precede the word 'class' in a class declaration?
A. local
B. public
C. static
D. volatile
E. synchronized

 : Which two may precede the word 'class' in a class declaration?
1. A,B
2. B,C
3. Access Mostly Uused Products by 50000+ Subscribers
4. D,E

5. A,E