把test.java救回来了
This commit is contained in:
+35
-35
@@ -1,35 +1,35 @@
|
||||
package task2;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Task {
|
||||
/********* Begin *********/
|
||||
public static void main(String[] args) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
String username = sc.next();
|
||||
// 判断用户名
|
||||
if (username.length() < 3) {
|
||||
try {
|
||||
throw new MyException("用户名小于3位Exception");
|
||||
} catch (MyException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
System.out.println("用户名格式正确");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class MyException extends java.lang.Exception {
|
||||
public MyException() {
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
public MyException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
/********* End *********/
|
||||
package task2;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Task {
|
||||
/********* Begin *********/
|
||||
public static void main(String[] args) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
String username = sc.next();
|
||||
// 判断用户名
|
||||
if (username.length() < 3) {
|
||||
try {
|
||||
throw new MyException("用户名小于3位Exception");
|
||||
} catch (MyException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
System.out.println("用户名格式正确");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class MyException extends java.lang.Exception {
|
||||
public MyException() {
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
public MyException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
/********* End *********/
|
||||
|
||||
Reference in New Issue
Block a user