匿名、静态代码块 Public class Person{ //2 { System.out.println("匿名代码块"); } //1 static{ System.out.println("静态代码块"); } //3 public Person(){ System.out.println( ...
分类:
其他好文 时间:
2020-09-18 00:45:45
阅读次数:
36
1.常用的是println,就是换行输出 2.print,不换行输出 3.printf常使用于格式转化 public class Print { public static void main(String[] args) { int a = 3,b=4; float c = 2.3564f; Sy ...
分类:
其他好文 时间:
2020-09-17 23:21:53
阅读次数:
23
发送端 ackage main import ( "fmt" "io" "net" "os" ) func main() { //获取文件属性 fmt.Println("请输入文件:") var path string fmt.Scan(&path) file, err := os.Open(pat ...
分类:
编程语言 时间:
2020-09-17 17:56:14
阅读次数:
31
##1. 为什么要用动态代理 对于一个类的方法 public class Calculator { public void add(int i,int j){ System.out.println("add方法调用,参数为"+i+","+j); System.out.println(i + j); ...
分类:
其他好文 时间:
2020-09-17 13:39:54
阅读次数:
30
1 Java程序基本结构 1.1 基本结构示例 /** * 可以用来自动创建文档的注释 */ public class Hello { public static void main(String[] args) { // 向屏幕输出文本: System.out.println("Hello, wo ...
分类:
编程语言 时间:
2020-09-17 13:30:39
阅读次数:
32
写测试时用占位符 MessageFormat.format 输出报错 仔细查看了一下我的语句 System.out.println(MessageFormat.format( "{method:{0}.{1},params:{2},user:[id:{3},username:{4}],ip:{5}, ...
分类:
编程语言 时间:
2020-09-14 19:07:03
阅读次数:
64
创建线程的方法 继承Thread类 继承Thread类,重写run方法,通过线程类实例.start()方法开启线程。 public class TestThread1 extends Thread{ @override public void run(){ System.out.println("线 ...
分类:
编程语言 时间:
2020-09-09 19:11:27
阅读次数:
47
继承(面向对象特征二) Java使用extends关键字来实现继承 package test; public class Person { private int age; private String name; public void fun1(){ System.out.println(thi ...
分类:
编程语言 时间:
2020-09-09 18:56:38
阅读次数:
35
1.首先写一个测试用例; public class Main { public static void main(String[] args) { System.out.println("Hello World!"); Thread thread = new Thread(new Worker()) ...
分类:
编程语言 时间:
2020-09-07 18:47:25
阅读次数:
40
public class MainTest { public static void main(String[] args) { //求sin值 double sin = Math.sin(3.14); System.out.println("sin3.14=" + sin); //求cos值 do ...
分类:
编程语言 时间:
2020-09-04 17:46:13
阅读次数:
87