system类
来源:互联网 发布:男士衣服搭配 知乎 编辑:程序博客网 时间:2024/06/10 11:10
ic static void main(String[] args) {
/** A:System类的概述
* System 类包含一些有用的类字段和方法。它不能被实例化。
* B:成员方法
* public static void gc()
* public static void exit(int status)
* public static long currentTimeMillis()
* pubiic static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
* C:案例演示
* System类的成员方法使用*/
//demo1();
//demo2();
//demo3();
int [] src ={11,22,33,44,55};
int [] dest =new int [8];
System.arraycopy(src, 0, dest, 0, src.length);
for (int i = 0; i < dest.length; i++) {
System.out.println(dest[i]);//拷贝数组数据
}
}
public static void demo3() {
long start =System.currentTimeMillis();
for (int i = 0; i < 1000; i++) {
System.out.println("*");
}
long end =System.currentTimeMillis();//计算程序运行时间以毫秒为单位
System.out.println(end-start);
}
public static void demo2() {
System.exit(0);
System.out.println("111111111");//推出java虚拟机
}
public static void demo1() {
for (int i = 0; i < 100; i++) {
new Demo();
System.gc();//运行垃圾回收机制 叫保洁阿姨
}
}
}
class Demo{ //在一个源文件中不允许定义两个public类
public void finalize(){
System.out.println("垃圾被清扫了");
}
/** A:System类的概述
* System 类包含一些有用的类字段和方法。它不能被实例化。
* B:成员方法
* public static void gc()
* public static void exit(int status)
* public static long currentTimeMillis()
* pubiic static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
* C:案例演示
* System类的成员方法使用*/
//demo1();
//demo2();
//demo3();
int [] src ={11,22,33,44,55};
int [] dest =new int [8];
System.arraycopy(src, 0, dest, 0, src.length);
for (int i = 0; i < dest.length; i++) {
System.out.println(dest[i]);//拷贝数组数据
}
}
public static void demo3() {
long start =System.currentTimeMillis();
for (int i = 0; i < 1000; i++) {
System.out.println("*");
}
long end =System.currentTimeMillis();//计算程序运行时间以毫秒为单位
System.out.println(end-start);
}
public static void demo2() {
System.exit(0);
System.out.println("111111111");//推出java虚拟机
}
public static void demo1() {
for (int i = 0; i < 100; i++) {
new Demo();
System.gc();//运行垃圾回收机制 叫保洁阿姨
}
}
}
class Demo{ //在一个源文件中不允许定义两个public类
public void finalize(){
System.out.println("垃圾被清扫了");
}
阅读全文
0 0
- System类
- System类
- System类
- System类
- System类
- System类
- System类
- System类
- System类
- System类
- System类
- System类
- System类
- 类 System
- System类
- System类
- System类
- System类
- mysql集群 之 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
- linux下java环境的搭建
- Jquery单引号和双引号的使用注意
- eclipse的异常断点和条件断点设置方式
- protocol buffer 常用API
- system类
- 从零开始学习音视频编程技术(30) Linux篇之系统安装
- 获取某段时间内的小时、日期、月份,存储过程中使用的较多。
- 图像分割—基于图像数据的自动选择阈值(基本全局阈值处理方法)
- #spring注入为空null,普通类中引用springIOC类
- Navicat 导入数据报错 --- 1153
- 安装Ubuntu 出现 SQUASFS error / sd 8:0:0:0 :[sdb] assuming drive cache:write through
- JNI笔记 JNI引用,异常处理,初始化成员变量
- MySql避免重复插入记录方法(ignore,Replace,ON DUPLICATE KEY UPDATE)