Distinguish between implicit and explicit type conversion in Java, with an example of each.
Values and Data Types
Original Khojo Papers practice question — not from a past board paper.
A primitive type holds the value itself directly in the variable, occupies a fixed amount of memory and has a default value; int and char are examples. A reference type holds the address of an object stored elsewhere, and its default value is null; String and any array are examples.
No citable source has been recorded for this record. Treat it as practice material, not as fact.
Assigning one reference variable to another copies the address, not the object.
From the same topic and chapter, at a similar level.
Distinguish between implicit and explicit type conversion in Java, with an example of each.
Values and Data Types
What is the output of: System.out.println(10 / 3); System.out.println(10 % 3); System.out.println(10.0 / 3);
Values and Data Types
What is the output of: int a = 7; int b = 2; System.out.println(a / b); System.out.println((double) a / b);
Values and Data Types
Name the eight primitive data types of Java and state the size of each.
Values and Data Types
Explain the ternary operator in Java and rewrite "if (a > b) max = a; else max = b;" using it.
Operators and Expressions in Java
What is the output of: String s = "Examination"; System.out.println(s.length() + " " + s.substring(0, 4) + " " + s.toUpperCase().charAt(2));
String Handling