Jan 5, 2011

My 2011 Resolution

  • Need to be more technically strong in Java
  • Need to learn Hindi[one of the major Indian Language]
  • Dancing and Swimming
  • 6 Pack for my body
Hope i will fulfill my resolution this year...!

Dec 23, 2010

Binary to Decimal in Java

Code:
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class BinarytoDecimal {

    public static void main(String[] argsthrows Exception {
       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Enter the binary value:");
         String binary = br.readLine();
        System.out.println("Decimal value is : "+Integer.parseInt(binary,2));

    }
}
Output:


Enter the binary value: 110
Decimal value is : 6

Decimal to Binary in Java

Code:
import java.lang.*;
import java.io.*;
public class DecimalToBinary{
  public static void main(String args[]) throws IOException{
  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
  System.out.println("Enter the decimal value:");
  String decimal= bf.readLine();
  int i = Integer.parseInt(decimal);  
  String binary = Integer.toBinaryString(i);
  System.out.println("Binary: " binary );
  }
}  


Output:


Enter the decimal value: 15
Binary: 1111

Dec 20, 2010

Free ATM Card

In almost all banks in India , if you open a savings account, they will offer you ATM card for free, in oder to withdraw money. But recently i have seen an Adv from a popular bank in bangalore. The Adv goes like this
"Open a Savings Account in our bank and We will offer you Free ATM card".
The Adv is funny isn't it..!!!

Dec 18, 2010

Black and White, Read All over

If any one ask this question to you, they would be spell "READ" as "RED". Dont get confuse, because the answer is very simple. Its "NEWS PAPER". The letters are in black color and its printed in a White sheet and it can be read all over the world.
Thats what its called as "Black and White, Read All over".

Dec 14, 2010

Nettipattam Wall Hangers

Nettipattam is an ornament   for Elephant which would  add glory to their trunk. During festival seasons, all elephants in Kerala would be wearing this. Nowadays, its available in the market of different size. Many people prefer this as their car hangers, which was made of polymer
For wide range of nettipattam, you can visit

http://www.godsowncraft.com/

Dec 8, 2010

Short Circuit Operators

&& and || are called short circuit operators. These operators are used for "AND" and "OR" operation respectively.
Ex.
if(a && b), Suppose if  a is false, it wont even check the value of b, it skip the condition itself. Take an another example:
if(refVal!=null && refVal.isValid() ) ,
 in this consider refVal is the reference variable and it has not been assigned to any object, so the value of refVal=null, so if its checking refVal.isValid(), it will throw the NullPointerException. Since, the first condition is false, it skips the second condition.