Type the programs in NOTEPAD or DOS prompt itself, for Consol Application.
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer
import java.io.*;
class day
{
public static void main(String args[])
{
int n;
try
{
DataInputStream x=new DataInputStream(System.in);
System.out.println("Enter a number upto 7");
n=Integer.parseInt(x.readLine());
switch(n)
{
case 1:
System.out.println("Sunday");
break;
case 2:
System.out.println("Monday");
break;
case 3:
System.out.println("Tuesday");
break;
case 4:
System.out.println("Wednesday");
break;
case 5:
System.out.println("Thursday");
break;
case 6:
System.out.println("Friday");
break;
case 7:
System.out.println("Saturday");
break;
default:
System.out.println("Invalid Number");
break;
}
}
catch(Exception e)
{
}
}
}
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer
Introduction to JAVA
before doing any JAVA Programs.
***********************************************************************************************
import java.io.*;
class day
{
public static void main(String args[])
{
int n;
try
{
DataInputStream x=new DataInputStream(System.in);
System.out.println("Enter a number upto 7");
n=Integer.parseInt(x.readLine());
switch(n)
{
case 1:
System.out.println("Sunday");
break;
case 2:
System.out.println("Monday");
break;
case 3:
System.out.println("Tuesday");
break;
case 4:
System.out.println("Wednesday");
break;
case 5:
System.out.println("Thursday");
break;
case 6:
System.out.println("Friday");
break;
case 7:
System.out.println("Saturday");
break;
default:
System.out.println("Invalid Number");
break;
}
}
catch(Exception e)
{
}
}
}
=========================================================================
Output :
Enter a number below 8
7