Tuesday, August 18, 2009

java code to hear Beep sound,Press any single Digit

import java.util.*;
public class Beep{


public static void main(String[] args) {

if(args[0].equals("1"))
System.out.println("\007");
if(args[0].equals("2"))
System.out.println("\007\007");
if(args[0].equals("3"))
System.out.println("\007\007\007");
if(args[0].equals("4"))
System.out.println("\007\007\007\007");
if(args[0].equals("5"))
System.out.println("\007\007\007\007\007");
if(args[0].equals("6"))
System.out.println("\007\007\007\007\007\007");
if(args[0].equals("7"))
System.out.println("\007\007\007\007\007\007\007");
if(args[0].equals("8"))
System.out.println("\007\007\007\007\007\007\007\007");
}

}

Thursday, March 26, 2009

java code to print a word in Double Quotes

import java.io.*;
public class names
{
public static void main(String [] x)throws IOException
{
System.out.println("Enter the name");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

String w=br.readLine();

System.out.println("\""+w+"\"");

}
}