This week's book giveaway is in the Servlets forum. We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line! See this thread for details.

the following code: 1. public class aclass 2. { 3. public static void main(String[] args) 4. { 5. int i = 015; 6. int j = 032; 7. int k = 078; 8. System.out.println(i); 9. System.out.println(j); 10. System.out.println(k); 11. } 12. } when compiled tells that "aclass.java:7:Invalid character in octal number. int k = 078;" here the mark points to the prefix zero. what is the mistake here. Thanks in advance

Just to expand on the previous answer, an octal number is in base 8. That means the valid digits are 0-7. Think about our "normal" base 10 numbers -- valid digits are 0-9. Binary is base 2 so valid digits are 0 and 1. Hex is the same in that the valid digits have values 0-15, but to keep them to a single character 10 is replaced with A, 11 with B, 12 with C, 13 with D, 14 with E, and 15 with F. The value 8 in octal is actually 10.