![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java
java基础
btwinkle
这个作者很懒,什么都没留下…
展开
-
自定义异常类
自定义的异常类有三个步骤 第一:建立异常类 public class DangerException extends Exception { String s = new String(); public DangerException(String s) { this.s =s + "属于危险品"; } public String Mess() { return s; } } 1.要使用extends Exception继承异常类 2.建立String类s 3.构造方法,这时候要将s原创 2020-12-03 16:38:33 · 621 阅读 · 0 评论 -
泛型——堆栈输出数列若干项
import java.util.*; public class Test1 { public static void main(String args[]) { Stack<Integer> stack = new Stack<Integer>(); stack.push(new Integer(8)); stack.push(new Integer(3)); System.out.println("第1项:3"); System.out.println("第原创 2020-12-10 14:54:47 · 503 阅读 · 0 评论