Java
有关于java的基础知识
who程序
小时不识月,读作胡程序。
又疑瑶台近,令威孔佳人。
展开
-
2020-08-14spring-boot-starter-parent &*
spring-boot-starter-parent 是当前项目的父级依赖spring-boot-starter-parent 的父依赖 spring-boot-dependenciesspring-boot-dependencies 管理 Spring Boot项目中的所有依赖版本spring-boot-starter-parent指明了资源路径<resources> <resource> <filtering>true&...原创 2020-08-14 13:17:14 · 109 阅读 · 0 评论 -
java循环foreach for
public static void main(String[] args) { int arr[][]=new int[8][8]; arr[1][1]=5; for(int row[]:arr){ for(int data:row){ /*System.out.println(row);*/ System.out.printf("\t"+data); } System.out.println("#33#");//换行 } S.原创 2020-06-13 12:04:54 · 93 阅读 · 0 评论 -
listIterator
public class ListTerator { public static void main(String[] args) { List<Integer> integers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8); ListIterator<Integer> test = integers.listIterator(); /* ListIterator<Integer> test2 =..原创 2020-06-12 21:27:21 · 171 阅读 · 0 评论 -
List
public interface List<E> extends Collection<E>//接口中的成员变量只能是public static final类型的。接口中不能含有静态代码块以及静态方法(用 static 修饰的方法),而抽象类是可以有静态代码块和静态方法。 4. 一个类只能继承一个抽象类,而一个类却可以实现多个接口。int size();Returns the number of elements in this list. If ...原创 2020-06-12 17:12:04 · 205 阅读 · 0 评论 -
写入Excel数据,简单且只能练手
import org.apache.poi.ss.usermodel.CellStyle;import org.apache.poi.ss.usermodel.FillPatternType;import org.apache.poi.ss.usermodel.Font;import org.apache.poi.ss.usermodel.HorizontalAlignment;import org.apache.poi.ss.usermodel.IndexedColors;import o.原创 2020-06-09 14:25:05 · 792 阅读 · 0 评论 -
写入Excel数据,没什么卵用
import org.apache.poi.hssf.usermodel.HSSFWorkbook;import org.apache.poi.ss.usermodel.*;import java.util.Iterator;import java.io.*;import javax.imageio.stream.FileImageInputStream;import javax.swing.JFileChooser;public class Excel2 { public static.原创 2020-06-09 14:22:38 · 126 阅读 · 0 评论 -
Array扩容
/** * @author 42267 * @version * @项目名称:conter * @类名称:ArrayList * @类描述: 增加数组扩容功能 * @创建时间:2020年6月8日 下午7:53:22 * @param <E> */public class tArrayList<E> { private Object[] elementData; private int size; private .原创 2020-06-08 19:55:52 · 144 阅读 · 0 评论 -
fileTree
public static void main(String[] args) { File f = new File("E:\\BaiduNetdiskDownload\\ JAVA初级阶"); printFile(f,0);//第一次调用时是0 } static void printFile(File file, int level){ //输出层数 for(int i=0;i<level;i++){ System.out.print("-");.原创 2020-06-08 16:17:43 · 385 阅读 · 0 评论 -
Math
/* * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */package java.lang;import java.util.Ra.原创 2020-06-08 15:03:10 · 95 阅读 · 0 评论 -
设置日期2
public static void main(String[] args) throws ParseException { System.out.println("请输入日期(格式:2020-5-20):"); Scanner scanner = new Scanner(System.in); /* The "standard" input stream. This stream is already open and ready to supply inp...原创 2020-06-08 14:55:05 · 207 阅读 · 0 评论 -
设置日期1
public static class mjb {/////封装时间格式 public static String toLDS(Date dt) { SimpleDateFormat mm = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒 E "); return mm.format(dt);//2020年06月08日 11时55分39秒 星期一 } public static String toSDS(Date dt) { Si.原创 2020-06-08 13:22:06 · 174 阅读 · 0 评论 -
内部类
/** * @author 42267 * @version * @项目名称:oop * @类名称:TestInnerClass * @类描述: 非静态内部类 * @创建时间:2020年6月6日 下午11:28:05 */public class TestInnerClass { public static void main(String[] args) { //创建内部类对象 Outer.Inner inner = new..原创 2020-06-06 23:29:45 · 54 阅读 · 0 评论 -
接口interface
/** * @author 42267 * @version * @项目名称:oop * @类名称:TestInterface * @类描述: 接口和实现类 * @创建时间:2020年6月6日 下午11:03:15 */public class TestInterface { public static void main(String[] args) { Volant v = new Angel(); v.fly(); Hon..原创 2020-06-06 23:13:46 · 60 阅读 · 0 评论 -
super父类对象
public class TestSuper { public static void main(String[] args) { System.out.println("开始创建一个ChildClass对象......"); new ChildClass2(); }}class FatherClass2 { public FatherClass2() { super(); System.out.println("创建.原创 2020-06-06 16:00:11 · 272 阅读 · 0 评论 -
方法重载
public static void main(String[] args) { System.out.println(add(3, 5));// 8 System.out.println(add(3, 5, 10));// 18 System.out.println(add(3.0, 5));// 8.0 System.out.println(add(3, 5.0));// 8.0 // 我们已.原创 2020-06-05 13:07:29 · 91 阅读 · 0 评论 -
方法的基本使用
public static void main(String[] args) { //通过对象调用普通方法 TestMethod tm = new TestMethod(); tm.printSxt(); int c = tm.add(30, 40, 50)+1000; System.out.println(c); } void printSxt(){ System.out.println("北京..."); System.out.println("上海....原创 2020-06-05 13:05:37 · 177 阅读 · 1 评论 -
if单选择结构
public class TestIf { public static void main(String[] args) { double d = Math.random(); //返回[0,1)之间的随机数,左闭右开 System.out.println(d); int h= (int)(6*Math.random()+1); System.out.println(h); if(h<=3) //如果不写大.原创 2020-06-05 12:55:29 · 180 阅读 · 0 评论 -
嵌套循环
public static void main(String[] args) { for(int i=1;i<=6;i++){///i控制数字,j控制循环次数 for(int j=1;j<=5;j++){ System.out.print(i+"\t");//\t表示制表符 } System.out.println();//加ln表示换行 } 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4原创 2020-06-05 12:35:37 · 92 阅读 · 0 评论