当前位置: 技术问答>java相关
来看看吧,烦人的问题!!!!
来源: 互联网 发布时间:2015-08-27
本文导语: 这个是别人做的,要交作业,能帮着改一下吗?谢谢啊!! /**java习题 *homework 1 * * @version 1.0 * Copyright 2002 */ //HelloWorld3.java 程序: public class HelloWorld3 { public static void main(String args[]) { System.out.println("Enter a ...
这个是别人做的,要交作业,能帮着改一下吗?谢谢啊!!
/**java习题
*homework 1
*
* @version 1.0
* Copyright 2002
*/
//HelloWorld3.java 程序:
public class HelloWorld3
{
public static void main(String args[])
{
System.out.println("Enter a chacter please:");
try
{
System.out.println(args[0]);
}catch(Exception e)
{
System.out.println("Hello,World!");
}
}
}
/**java习题
*homework 1
*
* @version 1.0
* Copyright 2002
*/
//HelloWorld3.java 程序:
public class HelloWorld3
{
public static void main(String args[])
{
System.out.println("Enter a chacter please:");
try
{
System.out.println(args[0]);
}catch(Exception e)
{
System.out.println("Hello,World!");
}
}
}
|
import java.io.*;
public class HelloWorld3
{
public static void main(String args[]) throws IOException
{
System.out.println("Enter a chacter please:");
try
{
System.out.println(args[0]);
BufferedReader keyin = new BufferedReader(new InputStreamReader(System.in));
String x = keyin.readLine();
}catch(Exception e)
{
System.out.println("Hello,World!" + "This is parameter you have enter:" + x);
}
}
}
public class HelloWorld3
{
public static void main(String args[]) throws IOException
{
System.out.println("Enter a chacter please:");
try
{
System.out.println(args[0]);
BufferedReader keyin = new BufferedReader(new InputStreamReader(System.in));
String x = keyin.readLine();
}catch(Exception e)
{
System.out.println("Hello,World!" + "This is parameter you have enter:" + x);
}
}
}
|
public class IOTest
{
public static void main(String args[])
{
System.out.println("Enter a chacter please:");
try
{
char c = (char)(System.in.read());
System.out.println("The chacter is " + c);
}catch(Exception e)
{
System.out.println("There is a IOException");
}
}
}
{
public static void main(String args[])
{
System.out.println("Enter a chacter please:");
try
{
char c = (char)(System.in.read());
System.out.println("The chacter is " + c);
}catch(Exception e)
{
System.out.println("There is a IOException");
}
}
}
|
上面这个在语法上没什么错啊,
只是在运行的时候多输一个参数就是了,
不然有异常
只是在运行的时候多输一个参数就是了,
不然有异常