Aug 18, 2011

Mulitple Catch Blocks in JDK 7

public static void main(String args[]) {
Scanner scnr = new Scanner(System.in);
String number = scnr.next();
try {
if (number.length() > 5) {
throw new IllegalArgumentException();
}
Integer.parseInt(number);

} catch (NumberFormatException | IllegalArgumentException e) {
e.printStackTrace();
}
}

Aug 17, 2011

Print a Diamond using JAVA


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Diamond {

public static void main(String[] args) {
Diamond diam = new Diamond();
diam.checkInput();
}

private void draw(int N, int counter, String sym) {
int max=0;

for (int i = 0; i < N;) {

for (int j = 0; j <= (N - i) / 2; j++) {
System.out.print(" ");
}
for (max = 0; max <= i; max++) {
System.out.print(sym);


}

System.out.println();

i = i + counter;


}


for (int i = (max - counter); i > 0;) {

for (int j = 0; j <= (N - i) / 2; j++) {
System.out.print(" ");
}
for (int k = i; k > 0; k--) {
System.out.print(sym);
}

System.out.println();
i = i - counter;

}
}

private String getInput() {
String value = null;

BufferedReader buf = new BufferedReader(
new InputStreamReader(System.in));
try {
value = buf.readLine();

} catch (IOException e) {
e.printStackTrace();
}
return value;
}

private void checkInput() {
System.out.print("Enter the Value of N:");
int N = Integer.parseInt(getInput());
System.out.print("\n Enter the Value for counter: ");
int counter = Integer.parseInt(getInput());
System.out.println("\n Enter the Diamond Symbol:");
String symbol = getInput();

System.out.println("Vaildating Check wait for 2 sec");
try {
Thread.sleep(2000);
} catch (InterruptedException e) {

e.printStackTrace();
}
if( N>0  && N%2 !=0  && counter >0 && counter%2 == 0 && counter
draw(N, counter, symbol);
}
else{
System.out.println("invalid data");
}



}

}

Aug 4, 2011

How to Unsubscribe from Snap Deal?

If you are getting annoyed with so many snap deal alerts, you can unsubscribe them from your mobile.
For that, please Click Here..

Notes:

  • Please enter your mobile number there and Click Summit Button there, you will be getting a verification pin in your mobile.
  • Please Enter the verification pin and provide the reason for un-subscription, if not you can choose "Others" in the List and provide your reason below
  • Once done, Click "Confirm to Un Subscribe ", you will be getting un-subscription confirmation message in your mobile
Then be happy :) 


Aug 3, 2011

Internet Explorer Users have low IQ

On average, Internet Explorer used were far than worst, where IE6 users were at the bottom. However, IE8 users performed slightly better. Other well known browsers like Firefox, Chrome and Safari were in the middle of the list and had small differences among them. Camino and IE with Chrome Frame were on top along with Opera. These users had the best average score.

In 2006, the same study says that IE was performing well. So this study may not be true.

Study By: AptiQuant, “psychometric consulting” firm

Aug 2, 2011

Can you make out 37 using five 5's

The Solution is very simple..
2^5 =32. To get 2, we can use ((5+5)/5)
So the answer is 

     (5+5)       
[   -------    ] ^ 5  + 5 ==>  2^5 + 5 = 32+ 5 =37
        5

Its quite complex, but by solving this, it will strength your aptitude skills.

Hot Water in WaterBottle

Usually we used to have a water bottle in office desks. We fill water in the morning. On a Monday morning, i found one of my friends bottle in the pantry and he used to drink only hot water. So i washed that bottle with cold water and filled it completely with hot water and carried to his desk. He thanked me for this activity at start. After few minutes, he felt thirsty and he drank  the water from the bottle. Suddenly he spitted the water on the floor and he started scolding me that Water is too hot.
I didn't realize that the water would be so hot. Even his water bottle would be like a flask not a plastic one.


Jul 18, 2011

Education - A Good Business

There's a old statement saying that
"if you were intelligent, you will work under someone,. But, it you were smart, you can give job to someone"

Through Business, you can be your own boss and earn money quickly,provided you are very smart enough".  As per me,education is a very good business . Say if you take Tamilnadu, there are around 502 Engg Colleges are there. All of them are AICTE approved and this count will increase in the nearby future. In a popular college in Chennai, the course fees per annum is Rs25-30 K, but you have to pay an additional of 70 K for the hostel,food and accommodation facilities. This fee is compulsory.
Thats the reason i mentioned Education became a good business. But few questions became doubtful 
1.Will quality and Standard of education will be good ? 
2. Will Education System be re modified?

Visitors please comment your opinions on this