002 Java 引用数据类型示例
目录
引用数据类型示例:
ScannerDemo
package day002;
import java.util.Scanner;
public class scanerdemo {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.println(sc.nextInt());
System.out.print(sc.next());
sc.close();
}
}
RandomDemo
package day002;
import java.util.Random;
public class RandomDemo {
public static void main(String[] args){
getRandInt();
}
public static void getRandInt(){
Random random = new Random();
System.out.print(random.nextInt(1000));
}
}