func text(c ...int) { fmt.Println(c)}func main() { var a = []int{1,2,3,4} text(a...) //...是将a这个列表中的值进行打散 相当于python中的**将字典转换成什么等于什么的那种形式 ...
分类:
其他好文 时间:
2019-12-11 21:44:30
阅读次数:
75
/** * 使用递归计算斐波拉契数列数据得到第20个值并打印 * 不死神兔 */public class Rabbits { public static void main(String[] args) { int num = f(20); System.out.println(num); } /* ...
分类:
其他好文 时间:
2019-12-10 20:57:39
阅读次数:
247
package main import "fmt" type animal interface { Eat() } type cat struct { } func (c cat) Eat() { fmt.Println("Cat like to eat fish!") } var _ animal... ...
分类:
其他好文 时间:
2019-12-10 16:52:50
阅读次数:
77
package testpacknm; import java.util.Scanner; public class testcnm { public static void main(String[] args) { int dNum = 5; System.out.println("Binary... ...
分类:
其他好文 时间:
2019-12-10 13:32:52
阅读次数:
84
我们使用的synchronized加的锁是可以延续使用的,如下: public void test() { //第一次获得锁 synchronized(this) { while(true) { //第二次获得同样的锁 synchronized(this) { System.out.println( ...
分类:
编程语言 时间:
2019-12-09 19:07:54
阅读次数:
79
总结:JRE;运行环境,包括JVM(java虚拟机)java程序所需的核心类库.jdk(开发工具包)是提供给开发人员的,也包括了JRE.public class Demo { public static void main(String[] args) { System.out.println("H ...
分类:
编程语言 时间:
2019-12-09 17:04:33
阅读次数:
90
1.bool bool 类型表示一个布尔值,值为 true 或者 false。 package main import "fmt" func main(){ var a bool = true fmt.Println(a) } 2.数字类型 int类型:表示整数 int8 int16 int32 i ...
分类:
其他好文 时间:
2019-12-09 17:01:08
阅读次数:
111
6使用对象 6.1字符类型 6.1.1字符类型 char和int互相转换 1 //a比A大32 2 Scanner in=new Scanner(System.in); 3 char c='B'; 4 char c1=(char)(c+'a'-'A'); 5 System.out.println(c ...
分类:
编程语言 时间:
2019-12-08 01:27:05
阅读次数:
85
package com.company.java.oop.cls; class ClassF { // static ClassF instance =new ClassF(); static { System.out.println("static{}.b =" +ClassF.b ); } st ...
分类:
其他好文 时间:
2019-12-07 21:34:29
阅读次数:
84
赋值运算符: 比较运算符: 赋值运算符的 = 符号,是用来将 = 符号右边的值,赋值给 = 符号左边的变量; 比较运算符的 == 符号,是用来判断 == 符号 左右变量的值是否相等的。 例子: int a = 3; int b = 4; System.out.println( a=b ); //4 ...
分类:
其他好文 时间:
2019-12-07 17:58:25
阅读次数:
80