Java Question
Java Question
13. Which symbol is used to contain the values of automatically initialized arrays?
A. Brackets C. Parentheses
B. Braces D. Comma
Java questions for information technology students
A. Set C. Collection
B. EventListner D. Comparator
A. Set C. Comparator
B. List D. Collection
47. Which of this interface must contain a unique element?
A. Set C. Array
B. List D. Collection
49. What is the value of tip after executing the following code snippet?
int meal = 5;
int tip = 2;
int total = meal + (meal>6 ? ++tip : --tip);
A. 1 C. 3
B. 2 D. 6
Java questions for information technology students
53. Can we keep a different name for the java class name and java file name?
A. Yes B. No
A. // C. <!-- -- >
B. /* */ D. All of these
55. What is the entry point of a program in Java?
A. main() method C. Last line of code
B. The first line of code D. main class
A. exep C. throw
B. excepHand D. All of these
57. Which class in Java is used to take input from the user?
A. Scanner C. Applier
B. Input D. None of these
A. 1 C. 8
B. No output D. 1357911
67. Array in java is ___.
A. Collection of similar elements C. The data type of consisting of
B. Collection of elements of different characters
types D. None of these
68. Which of these is the correct method to
create an array in java?
A. int[] arr = {1, 3, 5}; D. int arr[] = {1, 4, 6};
B. int[] arr; E. All of these
C. arr = new int[] {3, 1, 8};
69. Object in java are ___.
A. Classes C. Iterators
B. References D. None of these
Java questions for information technology students
class ThisKeyword {
private int a = 4;
private int b = 1;