public class JavaArray
{
public static void main(String[] args)throws Exception
{
String[] reasons = {"Easier to understand than VB.Net",
"Textbook is pretty decent",
"Very flexible",
"Alan makes it fun",
"Don't have to draw flowcharts for it",
"JGrasp is pretty cool",
"Made my first successful app",
"KISS approach works great",
"Great support",
"Jock asks ALOT of questions"};
int[] num = {1,2,3,4,5,6,7,8,9,10};
char choice;
int i;
System.out.print("\nEnter a number between 1 and 10: ");
choice = (char)System.in.read();
System.in.read();
System.in.read();
for (i = 0; i < 10; i++)
if (choice == num[i])
{
System.out.println("One of the Top 10 Reasons why I like Java: " + reasons[i]);
return;
}
System.out.println("Invalid Entry");
}
}
|