Wednesday, 22 August 2012

Top 10 Tricks To Fool Your Java Professor

Trick #1



  1. Is your java professor always yells at you ? 
  2. Does he/she always tells you that you don't know anything about Java ?

If the answer is yes then this post is for you

Its Payback time


Next time when you meet your professor in viva or in general ask him/her a simple question 

Q. can you show me a simple program which print a NUMBER 0123 ?

if your professor is smart enough he/she will write this code 

System.out.println(123);

and gives you a explanation about why he/she has not written 0 (zero) 

if your professor in dumb (which 80% are) will end up with this code


System.out.println(0123);
So, when he will execute this code he will get output as 83
CONFUSED ???

This is because if any number is padded with initial 0 then that number is treated as Octal in Java so when you execute above code the JVM will convert the Octal to Decimal and print 83 on stdout.

So when you will explain this to your professor without the help of Google then he will be impressed :)

The problem is that most people just learn the syntax of a language and not its capability, learning syntax is very easy any moron can learn it within a month or so but learning capability takes almost years of expertise.

Wait for the next trick #2
till that time
stay hungry stay foolish