摘要:
自定义异常 package com.exception.demo02; //自定义的异常类 public class MyException extends Exception{ //传递数字>10 private int detail; public MyException(int a){ thi 阅读全文
摘要:
异常2:捕获和抛出异常 package com.exception; public class Test { public static void main(String[] args) { int a = 1; int b = 0; try {//try监控区域 System.out.printl 阅读全文
摘要:
内部类 package zhaiyang.oop.demo10; public class Outer { private int id=100; public void out(){ System.out.println("这是外部类的方法"); } public class Inner{ pub 阅读全文
摘要:
接口的定义与实现 package zhaiyang.oop.demo09; //抽象思维 //interface定义的关键字,接口都需要实现类 public interface UserService { //常量 public static final int AGE = 99; //接口中的所有 阅读全文
摘要:
static& final关键字详解\代码块\静态导入包 package zaiyang.oop.demo07; public class Student { //static private static int age;//静态的变量,推荐使用类名访问,静态变量在类中只有一个,它能被类中的所有实 阅读全文
摘要:
什么是多态 package zaiyang.oop.demo06; public class Person { public void run(){ System.out.println("run"); } /* 多态注意事项: 1.多态是方法的多态,属性没有多态 2.父类和子类要有联系。类型转换异 阅读全文