摘要:
import java.sql.Connection; import java.io.IOException; import java.sql.SQLException; //java异常处理 //异常 public class test82 { //定义方法声明定义异常,在满足条件时抛出异常对象, 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(74)
评论(0)
推荐(0)
摘要:
public class Employee { private String name; private String ags; public void setName(String name) { this.name = name; } public String getName() { retu 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(29)
评论(0)
推荐(0)
摘要:
//异常 public class test79 { //定义方法声明定义异常,在满足条件时抛出异常对象,程序转向异常处理 public double count(double n,double m)throws Exception { if (m == 0) {//如果除数等于0.则抛出异常实例 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(43)
评论(0)
推荐(0)
摘要:
//java异常初识 public class test78 { public static void main(String[] args) { countArraylength( -1 ); } public static int countArraylength(int length) { i 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(35)
评论(0)
推荐(0)
摘要:
@SuppressWarnings("all") public class GJClass<T> { public String getClassName(T t){ return t.getClass().getName(); } } 测试类 public class test76 { publi 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(26)
评论(0)
推荐(0)
摘要:
定义一个员工类 public class Employee { private String name; private String ags; public void setName(String name) { this.name = name; } public String getName( 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(35)
评论(0)
推荐(0)
摘要:
import java.util.ArrayList; import java.util.List; //泛型通配符的使用 public class test73 { public static void main(String[] args){ List<Integer> intList=new 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(33)
评论(0)
推荐(0)
摘要:
import java.util.*; public class test71 { public static void main(String[] args){ Scanner in=new Scanner(System.in); System.out.println("请输入学生的信息"); L 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(29)
评论(0)
推荐(0)
摘要:
import java.util.Hashtable; //hashtable public class test70 { public static void main(String[] args){ Hashtable ht=new Hashtable(); ht.put("k0","歌谣"); 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(26)
评论(0)
推荐(0)
摘要:
public class Department { private String code;//部门编号 private String name;//部门名字 private int quanity;//部门人员数量 public void setCode(String code) { this.c 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(36)
评论(0)
推荐(0)
摘要:
import java.util.Date; public class Car { private String brand;//品牌 private Date createDate; private int housepower;//马力 private int speed;//速度 public 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(53)
评论(0)
推荐(0)
摘要:
定义一个汽车类 import java.util.Date; public class Car { private String brand;//品牌 private Date createDate; private int housepower;//马力 private int speed;//速 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(36)
评论(0)
推荐(0)
摘要:
finally作为异常处理的一部分,它只能用在try/catch语句中,并且附带一个语句块,表示这段语句最终一定会被执行(不管有没有抛出异常),经常被用在需要释放资源的情况下。 之前在写爬虫的时候数据库连接的频率很高,有时候数据处理的不好,sql报错后,抛出异常但后边的数据库连接没有断开。导致最后数 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(68)
评论(0)
推荐(0)
摘要:
//throw抛出异常 import java.util.Scanner; public class test66{ static class A { void d() throws Exception { int a, b, c; Scanner in = new Scanner(System.i 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(148)
评论(0)
推荐(0)
摘要:
//异常处理 import java.util.Scanner; public class test65 { public static void main(String[] args){ int a,b,c; Scanner in=new Scanner(System.in); try { Sys 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(29)
评论(0)
推荐(0)
摘要:
public class Province { private String name;//省份名称 private long area;//土地面积 private boolean general;//是普通省份还是特殊省份 public String getName() { return nam 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(41)
评论(0)
推荐(0)
摘要:
import java.util.Comparator; public class GoodsSorts implements Comparator { public int compare(Object o1,Object o2){ Goods g1=(Goods)o1; Goods g2=(Go 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(32)
评论(0)
推荐(0)
摘要:
//自定义排序 import java.util.*; public class test62 { public static void main(String[] args){ TreeSet tree=new TreeSet();//创建一个采用默认树形自然排序的对象 tree.add(new 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(70)
评论(0)
推荐(0)
摘要:
//treeset排序集合 import java.util.*; public class test61{ public static void main(String[] args){ TreeSet tree=new TreeSet();//创建一个采用默认树形自然排序的对象 tree.add 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(34)
评论(0)
推荐(0)
摘要:
public class Goods { //商品实体类 private String number;//商品编号 private String name;//商品价格 private double price;//商品单价 private int quantity;//商品数量 public vo 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(35)
评论(0)
推荐(0)
摘要:
public class Goods { //商品实体类 private String number;//商品编号 private String name;//商品价格 private double price;//商品单价 private int quantity;//商品数量 public vo 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(43)
评论(0)
推荐(0)
摘要:
import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; //员工信息类 //date类 public class test50 { private String name; priv 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(76)
评论(0)
推荐(0)
摘要:
package com.zx; import java.text.DateFormat; import java.util.Date; //员工信息类 //date类 public class test50 { private String name; private String sex; pri 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(93)
评论(0)
推荐(0)
摘要:
import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; //员工信息类 //date类 public class test50 { private String name; priv 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(37)
评论(0)
推荐(0)
摘要:
import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; //员工信息类 //date类 public class test50 { private String name; priv 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(33)
评论(0)
推荐(0)
摘要:
//math import java.util.Scanner; public class test55 { public static void main(String[] args){ Scanner in=new Scanner(System.in); System.out.println(" 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(39)
评论(0)
推荐(0)
摘要:
import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; //员工信息类 //date类 public class test50 { private String name; priv 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(153)
评论(0)
推荐(0)
摘要:
import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class test53 { public static void main(String[] args){ //获 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(36)
评论(0)
推荐(0)
摘要:
package com.zx; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; //员工信息类 //date类 public class test50 { private S 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(45)
评论(0)
推荐(0)
摘要:
import java.util.Date; import java.util.Scanner; public class test51 { public static void main(String[] args){ Scanner in=new Scanner(System.in); Syst 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(36)
评论(0)
推荐(0)
摘要:
String、StringBuffer和StringBuilder区别 1、长度是否可变 String 是被 final 修饰的,他的长度是不可变的,就算调用 String 的concat 方法,那也是把字符串拼接起来并重新创建一个对象,把拼接后的 String 的值赋给新创建的对象 StringB 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(59)
评论(0)
推荐(0)
摘要:
public class test48 { //连接字符串 public static String concatString(String base,String[] str){ StringBuilder builder=new StringBuilder(base);//构建可变字符串 for 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(45)
评论(0)
推荐(0)
摘要:
//stringbuilder public class test47 { public static void main(String[] args){ StringBuilder builder=new StringBuilder("我是一个热血的少年"); System.out.println 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(32)
评论(0)
推荐(0)
摘要:
public class test45 { //将给定的字符串返回成一个数组 public static char[] toArrayFromString(String target){ return target.toCharArray(); } //大小写转换根据所给的第二个参数取决于大小写转换 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(148)
评论(0)
推荐(0)
摘要:
public class test44 { //分割字符串数组 public static String[] spitString(String resource,String tag){ return resource.split(tag); } } 测试 public class test43 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(43)
评论(0)
推荐(0)
摘要:
//String方法 public class test41 { //比较两个人的姓名是否相同 public static boolean eqName(String name1,String name2){ return name2.equals(name1)?true:false; } //按照 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(89)
评论(0)
推荐(0)
摘要:
//字符串概述 public class test40 { public static void main(String[] args){ char[] str1={'1','2','3','4','5','6','7','8','9'}; String str2=new String("我是歌谣" 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(23)
评论(0)
推荐(0)
摘要:
arraylist的查询和删除 //arraylist的遍历和增加 import java.util.ArrayList; public class test38 { public static void main(String[] args){ ArrayList aa1=new ArrayLis 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(40)
评论(0)
推荐(0)
摘要:
//arraylist的遍历和增加 import java.util.ArrayList; public class test37 { public static void main(String[] args){ ArrayList aa1=new ArrayList(); //当前对象个数 Sy 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(53)
评论(0)
推荐(0)
摘要:
//集合类的作用 public class test35 { private String name; private int num; private int grade; public test35(String name,int num,int grade){ this.name=name; 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(30)
评论(0)
推荐(0)
摘要:
/Character包装类 public class test23 { public static void main(String[] args){ char ch='A'; //使用构造方法 Character obj1=new Character('中'); //使用静态方法 Characte 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(43)
评论(0)
推荐(0)
摘要:
//买票问题 class Xc9 implements Runnable{ public static int chepiao=100; static String aa=new String("1");//字符串随意定义,定义在函数上面 public void run(){ while (true 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(44)
评论(0)
推荐(0)
摘要:
public class test33 { public static void main(String[] args) { Xc46 xc46=new Xc46(); Thread dd = new Thread(xc46); dd.start(); try { dd.join(); } catc 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(204)
评论(0)
推荐(0)
摘要:
public class test32 { public static void main(String[] args){ Thread xc13=new Thread(new Xc44()); Thread xc14=new Thread(new Xc44()); xc13.setName("线程 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(25)
评论(0)
推荐(0)
摘要:
//线程的睡眠 public class test31 { public static void main(String[] args){ Xc43 xc43=new Xc43(); Thread ccc=new Thread(xc43); ccc.start(); } } class Xc43 i 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(25)
评论(0)
推荐(0)
摘要:
public class test30 { public static void main(String[] args){ Thread xc11=new Thread(new Xc41()); Thread xc12=new Thread(new Xc42()); xc11.setPriority 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(49)
评论(0)
推荐(0)
摘要:
//创建线程 class Xc3 extends Thread { public void run(){ System.out.println("当前线程的名称为"+Thread.currentThread().getName()); } } public class test29{ public 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(42)
评论(0)
推荐(0)
摘要:
//创建线程的第二种方法 class Xc2 implements Runnable { public void run(){ for (int i=0;i<20;i++){ System.out.println("我是歌谣"); } } } public class test28{ public 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(18)
评论(0)
推荐(0)
摘要:
//线程的创建方法1 class Xc extends Thread { public void run(){ for (int i=0;i<20;i++){ System.out.println("我是歌谣"); } } } public class test27{ public static v 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(23)
评论(0)
推荐(0)
摘要:
//System类 import java.util.Date; import java.util.Properties; public class test26 { public static void main(String[] args){ testOut(-1); //获取系统时间 long 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(58)
评论(0)
推荐(0)
摘要:
//Character方法大小写转换 public class test25 { public static void main(String[] args) { char ch = 'A'; //使用构造方法 Character obj1 = new Character('中'); //使用静态方 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(157)
评论(0)
推荐(0)
摘要:
//Character方法数量统计 public class test24 { public static void main(String[] args) { char ch = 'A'; //使用构造方法 Character obj1 = new Character('中'); //使用静态方法 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(72)
评论(0)
推荐(0)
摘要:
public class test22 { public static void main(String[] args){ int num=5; Integer obj1=new Integer(num); System.out.println("obj1的值为"+obj1); Integer ob 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(37)
评论(0)
推荐(0)
摘要:
public class test22 { public static void main(String[] args){ int num=5; Integer obj1=new Integer(num); System.out.println("obj1的值为"+obj1); Integer ob 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(47)
评论(0)
推荐(0)
摘要:
测试类 public class test22 { public static void main(String[] args){ int num=5; Integer obj1=new Integer(num); System.out.println("obj1的值为"+obj1); Intege 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(45)
评论(0)
推荐(0)
摘要:
//object常用方法 public class test21 { public static void main(String[] args) { Object obj = new Object(); ObjectCl usr = new ObjectCl(); usr.setAge(6); u 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(39)
评论(0)
推荐(0)
摘要:
//常用基础类 public class ObjectClass { private String name; private int age; public void say(){ System.out.println(name); System.out.println(age); } publi 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(54)
评论(0)
推荐(0)
摘要:
//静态代码块内部类 public class test18{ private static final String URL; private static final String DEVICE; private static final String USER; private static 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(40)
评论(0)
推荐(0)
摘要:
//静态代码块 class test16 { private static final String URL; private static final String DEVICE; private static final String USER; private static final Str 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(33)
评论(0)
推荐(0)
摘要:
//qq界面 //面向对象思想,面板,窗口的基础之上再加窗口 import java.awt.*; import javax.swing.*; public class test15 extends JFrame { JLabel bq1;//北部 JButton an1,an2,an3; JPan 阅读全文
posted @ 2022-06-25 15:26
前端导师歌谣
阅读(53)
评论(0)
推荐(0)

浙公网安备 33010602011771号