Top "Scjp" questions

SCJP is a certification for programmers experienced using the Java programming language.

Formatting using printf and format

In the following program class ZiggyTest2 { public static void main(String[] args){ double x = 123.456; char c = 65; int i = 65; System.out.…

java formatting scjp ocpjp
What are "connecting characters" in Java identifiers?

I am reading for SCJP and I have a question regarding this line: Identifiers must start with a letter, a …

java unicode identifier scjp
Why does Double.NaN==Double.NaN return false?

I was just studying OCPJP questions and I found this strange code: public static void main(String a[]) { System.out.…

java floating-point nan scjp ocpjp
Java unreachable catch block compiler error

Why in Java can we catch an Exception even if it is not thrown, but we can't catch it's subclass (…

java scjp
Enum as instance variables

If you have an enum such as enum Coffee { BIG, SMALL } and a class that has an instance variable like …

java enums scjp
How long should I prepare for SCJP?

Ok I know this might sound a bit silly, as it depends on the person, but on average how much …

java scjp
Java - When is it a compiler error and when is it a runtime exception?

I am currently studying for the SCJP certification using the Sierra and Bates Study Guide and in many of the …

java exception compilation scjp
Bitwise shift operators. Signed and unsigned

I'm practising for the SCJP exam using cram notes from the Internet. According to my notes the >> operator …

java bit-shift scjp
How can't we compare two enum values with '<'?

If enum implements Comparable so why can't compare with < or >? public class Dream { public static void main(String... …

java enums scjp ocpjp
Why can not I add two bytes and get an int and I can add two final bytes get a byte?

public class Java{ public static void main(String[] args){ final byte x = 1; final byte y = 2; byte z = x + y;//ok …

java int variable-assignment scjp ocpjp