一、将字符串转换为其他类型 str := "hello world" //将字符串转换为字符切片 强制类型转换 slice := []byte(str) fmt.Println(slice) fmt.Printf("%c\n", slice) //字符切片转换为字符串 强制类型转换 str2 := ...
分类:
编程语言 时间:
2020-03-28 10:23:31
阅读次数:
79
第一种: 1 File f = new File(this.getClass().getResource("/").getPath()); 2 System.out.println(f); 结果: C:\Documents%20and%20Settings\Administrator\workspa ...
分类:
编程语言 时间:
2020-03-28 01:03:47
阅读次数:
87
使用反射之前的代码 public class P1 { public void eat(){ System.out.println("p1的方法"); } } public class P2 { public void sleep(){ System.out.println("p2的方法"); } ...
分类:
其他好文 时间:
2020-03-27 10:48:40
阅读次数:
49
求1-10的和 func sum(num int) int { if num == 1 { return 1 } return sum(num-1) + num } func main() { ret := sum(10) fmt.Println(ret) } ...
分类:
其他好文 时间:
2020-03-26 19:13:18
阅读次数:
41
package test; import java.util.Scanner; public class LH { public static void main(String[] args) { System.out.println("请输入一个值x"); Scanner input=new Sc ...
分类:
其他好文 时间:
2020-03-26 14:04:10
阅读次数:
86
请看下面的程序即可: public class MapTest { public static void main(String[] args){ Map map = new HashMap(); //定义Map集合对象 System.out.println("Map集合的isEmpty方法返回值是 ...
分类:
其他好文 时间:
2020-03-25 23:13:35
阅读次数:
211
public interface Extends { void show(); void show2();}public class SourceObj { void method() { System.out.println("父亲方法"); }}//适配器对象public class Adapt... ...
分类:
其他好文 时间:
2020-03-25 19:08:00
阅读次数:
74
关于IDEA工具的快捷键及一些简单的设置: 1.字体设置 file >settings > 输入font > 设置字体样式以及字号大小。 2.快速生成main方法 psvm或者main 3.快速生成System.out.println() sout 4.注意:IDEA是自动保存的,不需要ctrl+s ...
分类:
其他好文 时间:
2020-03-25 19:06:49
阅读次数:
87
String che = "生产用车";Integer Isjwct = 0;String mk = che.equals("生产用车") ? (Isjwct.equals(0) ? "m2" : "m3") : null;System.out.println(mk); ...
分类:
编程语言 时间:
2020-03-24 16:07:37
阅读次数:
225
准备知识:抽象类具有多态特性。 模板方法设计模式:整体步骤固定、通用,这些步骤已在父类中写好,把易变的部分抽象出来,供其不同的子类实现。 示例 父类 abstract class BankTemplate { private void ticket(){ System.out.println("请排 ...
分类:
其他好文 时间:
2020-03-22 12:26:46
阅读次数:
83