Tiantian said to use System.out.println for output, so I have a small question to ask, is out a variable or an internal class? Large and systematic knowledge is explained in detail in various topics. We cannot ignore these scattered knowledge points, otherwise it will be very embarrassing if we are asked such a simple question during the interview and cannot answer it.
Non-instantiable System class
System is a system class. In the java.lang package of JDK, it can be seen that it is also a core language of java. characteristic. The constructor of the System class is decorated with private and is not allowed to be instantiated. Therefore, the methods in the class are also static modified static methods.
Field
public final static InputStream in; //标准输入流 public final static PrintStream out; //标准输出流 public final static PrintStream err; //标准错误流
It can be seen that out and in in System are not internal classes, but genuine field variables. out is the variable field modified by PrintStream's final static, which means it can call methods of the PrintStream class. Println is an output method of PrintStream, so we usually use System.out.println() to output content on the console.
Commonly used methods in System
arraycopy—— ArrayCopy
public static void main(String[] args) { int[] arr1 = { 0, 1, 2, 3, 4 }; int[] arr2 = { 9, 9, 9, 9, 9 }; System.arraycopy(arr1, 2, arr2, 0, 3); arr1[3] = 8; for (int i = 0; i < 5; i++) System.out.print(arr2[i] + " "); //2 3 4 9 9 }
The arraycopy method has five parameters, which are the array to be copied, the starting position to be copied, the array to copy to, the starting position of the array to copy, and the copy to the end of this array. This method is similar to copyOf and copyOfRange in Arrays. It has more parameters and can be used if necessary.
currentTimeMillis——Return the number of milliseconds
I won’t give an example here, the currentTimeMillis method and the getTime method in the Date class It's exactly the same, if you just need milliseconds, such a call is also very convenient. However, it should be noted that currentTimeMillis does not directly get the result of getTime. currentTimeMillis is a local method that returns the time of the operating system. Since the minimum accuracy of the time of some operating systems is 10 milliseconds, this method may cause some deviations. .
getProperty——Get the system attribute
We call this method and enter the key ## in the parameter #StringGet system properties.
Key | Description of related values |
---|---|
Java Runtime Environment Version | |
Java Runtime Environment Vendor | |
Java Provider URL | |
Java | InstallationDirectory |
Java Virtual Machine Specification Version | |
Java Virtual Machine Specification Supply Business | |
Java virtual machine specification name | |
Java virtual machine implementation version | |
Java virtual machine implementation vendor | |
Java virtual machine implementation name | |
Java runtime environment specification version | |
Java Runtime Environment Specification Vendor | |
Java Runtime Environment specification name | |
class.version | Java class format version number|
Java class path | |
List of paths to search | when loading the library |
Default temporary file path | |
To The name of the JIT compiler to use | |
The path to one or more extension directories | |
The name of the operating system | |
Architecture of the operating system | |
Operating system version | |
.separatorFile separator ( In UNIX systems it is "/") | |
Path separator (in UNIX systems it is ":") | |
Line separator ("/n" on UNIX systems) | |
user Account name | |
User’s home directory | |
user Current working directory |
The above is the detailed content of In-depth analysis of java-System system class. For more information, please follow other related articles on the PHP Chinese website!

Java文档解读:System类的currentTimeMillis()方法用法解析,需要具体代码示例在Java编程中,System类是一个非常重要的类,其封装了与系统相关的一些属性和操作。其中,currentTimeMillis方法是System类中非常常用的一个方法,本文将对该方法做详细解读并提供代码示例。一.currentTimeMillis方法概述

win10系统是一款非常好用的高智能系统,强大的兼容性可以确保系统在正常的使用过程中基本不会出现任何的问题,但是随着人们对win10系统的不断使用有时候系统也会出现win10开机蓝屏终止代码systemserviceexception的问题,今天小编就为大家带来了win10开机蓝屏终止代码systemserviceexception的解决办法有需要的话就快来下载吧。win10systemserviceexception蓝屏的解决办法:方法一:1、使用Windows键+R打开运行,输入“contr

电脑的system是比较常见的一种系统进程,在查看进程的时候经常会看到system,这个进程简单来说就是电脑系统的意思;但是,如果电脑中出现了system.exe的进程,需要及时删除,这是一个木马病毒生成的文件,真正的system后边是没有exe后缀的。

微软已宣布System Center 2022 的可用性。最新版本带来了 System Center Operations Manager (SCOM)、Virtual Machine Manager (VMM)、System Center Orchestrator (SCORCH)、Service Manager (SM) 和 Data Protection Manager

相信网友们都对windows7系统非常熟悉,那大家听说过windows7英文版系统吗?相信有非常多的网友都对windows7英文版系统略有耳闻,不过有的朋友找windows7英文版系统下载,今天小编就要把win7英文原版系统介绍分享给大家,让网友们都能了解到英文win7原版系统。下面就是告诉你windows7英文版系统哪里下载。win7英文原版系统已发布到MSDN订阅下载,官方首先发布的英文集成版,Windows7WithSP1,即集成SP1的Windows7光盘镜像。包含适用于多语言的SP1独

时光倒流回到1990年代的Macintosh,在浏览器窗口中运行System7和MacOS8的完整虚拟安装。1990年代Mac软件的新虚拟版本存在一个缺陷,那就是它们以2020年代Mac的速度运行。您看到的是MacSE/30或Quadra700,但一切都与AppleSilicon一样快。您可以在这些模拟操作系统中进行实际工作,它们甚至可以将文档或文件从macOSMonterey拖入和拖出。但无论是出于某些实际目的还是更可能是为了纯粹的乐趣,这里是如何

Object是java所有类的基类,是整个类继承结构的顶端,也是最抽象的一个类。大家天天都在使用toString()、equals()、hashCode()、waite()、notify()、getClass()等方法,或许都没有意识到是Object的方法,也没有去看Object还有哪些方法以及思考为什么这些方法要放到Object中。一、JavaObject类简介-所有类的超类Object是Java类库中的一个特殊类,也是所有类的父类。也就是说,Java允许把任何类型的对象赋给Object类型的

一.介绍System作为系统类,在JDK的java.lang包中,可见它也是一种java的核心语言特性。System类的构造器由private修饰,不允许被实例化。因此,类中的方法也都是static修饰的静态方法。JAVA中的Arrays类是一个实现对数组操作的工具类,包括了各种各样的静态方法,可以实现数组的排序和查找、数组的比较和对数组增加元素,数组的复制和将数组转换成字符串等功能。这些方法都有对所有基本类型的重载方法。二.知识点详解1、概念在API中System类介绍的比较简单,我们给出定义


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

Atom editor mac version download
The most popular open source editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Dreamweaver Mac version
Visual web development tools
