java中getProperties是什么意思呢,如何使用呢

java中接口是什么意思~

接口可以说是为了提供一种规范,方便其他地方使用此规范的一种技术。
在现实生活中可以接口的例子很多,比如USB接口。它定义了USB口的大小,4跟USB线每根线的颜色、作用等。在软件方面定义了供CPU调用的一些方法。比如识别、启动、弹出、传送数据等等。采用USB接口的设备很多,有鼠标、键盘、u盘等等。每种设备实现识别、启动、弹出、传送数据的方式不一样。

在java中,接口定义了一些方法,但是不用去实现,而由实现了此接口的类去实现接口中定义的方法,比如有一个接口叫做USB,有一个类叫做鼠标,USB接口定义了启动、传送数据等方法。那么鼠标实现了USB接口,就得实现启动、传送数据方法。另外一个类叫做U盘也实现了USB接口、那么它也要实现启动、传送数据。 在鼠标或者U盘连接上电脑后,CPU发现有USB设备连接上电脑了(cpu并不知道是什么设备,只知道是USB设备),这个时候CPU会发出启动命令来启动USB设备,而启动鼠标和启动U盘具体流程是不一样的,这些启动流程都是有鼠标和U盘各自来实现的。

this表示类实例本身。
this的用法
1、表示对当前对象的引用!

1
2
3
4
5

public class A{
public A getA(){
return this;//表示获取当前实例本身
}
}


2、表示类的成员变量,而非函数参数,注意在函数参数和成员变量同名是进行区分!

1
2
3
4
5
6

public class A{
private int a = 0;//位置1
public A getA(int a){
this.a = a;//前面this.a表示 位置1 的a,赋值=号右侧的表示参数a
}
}


3、用于在构造方法中引用满足指定参数类型的构造器。

1
2
3
4
5
6
7

public class A{
public A(int a){
}
public A(){
this(1);//这里调用自身的构造函数public A(int a){
}
}

java中的getProperties()方法是System类的一个方法,System可以有对标准输入,标准输出,错误输出流;对外部定义的属性和环境变量的访问;加载文件和库的方法;还有快速复制数组的一部分的实用方法。
System.getProperties()可以确定当前的系统属性,返回值是一个Properties,可以通过System.getProperties()获取系统的参数。

具体使用方法如下:
Properties props=System.getProperties(); //系统属性
System.out.println("Java的运行环境版本:"+props.getProperty("java.version"));
System.out.println("Java的运行环境供应商:"+props.getProperty("java.vendor"));
System.out.println("Java供应商的URL:"+props.getProperty("java.vendor.url"));
System.out.println("Java的安装路径:"+props.getProperty("java.home"));
System.out.println("Java的虚拟机规范版本:"+props.getProperty("java.vm.specification.version"));
System.out.println("Java的虚拟机规范供应商:"+props.getProperty("java.vm.specification.vendor"));
System.out.println("Java的虚拟机规范名称:"+props.getProperty("java.vm.specification.name"));
System.out.println("Java的虚拟机实现版本:"+props.getProperty("java.vm.version"));
System.out.println("Java的虚拟机实现供应商:"+props.getProperty("java.vm.vendor"));
System.out.println("Java的虚拟机实现名称:"+props.getProperty("java.vm.name"));
System.out.println("Java运行时环境规范版本:"+props.getProperty("java.specification.version"));
System.out.println("Java运行时环境规范供应商:"+props.getProperty("java.specification.vender"));
System.out.println("Java运行时环境规范名称:"+props.getProperty("java.specification.name"));
System.out.println("Java的类格式版本号:"+props.getProperty("java.class.version"));
System.out.println("Java的类路径:"+props.getProperty("java.class.path"));
System.out.println("加载库时搜索的路径列表:"+props.getProperty("java.library.path"));
System.out.println("默认的临时文件路径:"+props.getProperty("java.io.tmpdir"));
System.out.println("一个或多个扩展目录的路径:"+props.getProperty("java.ext.dirs"));
System.out.println("操作系统的名称:"+props.getProperty("os.name"));
System.out.println("操作系统的构架:"+props.getProperty("os.arch"));
System.out.println("操作系统的版本:"+props.getProperty("os.version"));
System.out.println("文件分隔符:"+props.getProperty("file.separator")); //在 unix 系统中是"/"
System.out.println("路径分隔符:"+props.getProperty("path.separator")); //在 unix 系统中是":"
System.out.println("行分隔符:"+props.getProperty("line.separator")); //在 unix 系统中是"/n"
System.out.println("用户的账户名称:"+props.getProperty("user.name"));
System.out.println("用户的主目录:"+props.getProperty("user.home"));
System.out.println("用户的当前工作目录:"+props.getProperty("user.dir"));

proper什么意思
答:双语例句:1、His family insisted he should be given a proper burial.他的家人坚持要为他举行适当的葬礼。2、More people will be doing the work with proper supervision and thus, more safely.更多人将在适当的监督下从事这项工作,因而会更安全。3、When are you going to get a proper ...

java认证考试SCWCD的310-081和310-080的具体内容有何区别??
答:identify the proper scope for an attribute; and identify multi-threading issues associated with each...2008-10-28 关于SCWCD考试的疑问 1 2015-06-09 java认证考试有哪些,考什么,什么时候考,报名费多少

请问JAVA中正则表达式匹配怎么实现的!
答:Java中正则表达式匹配的语法规则:以下是整理出来的Java下运用正则表达式实现匹配的程序案例,代码如下:package org.luosijin.test;import java.util.regex.Matcher;import java.util.regex.Pattern;/** * 正则表达式 * @version V5.0 * @author Admin * @date 2015-7-25 */public class Regex ...

写一个Properties格式的配置文件,配置类的完整名称,写一个程序,读取这...
答:我今天也遇到跟你一样的问题,纠结了两天,现在弄明白了,异常提示找不到这个类,说明你的配置文件出了问题,name = com.heima.changjaijie.Eight.DemoClass,需要进到你的DemoClass类里,选中DemoClass,鼠标右键点copy Qualifield Name,也就是复制它的类路径,然后粘贴在你的配置文件name等号右边,注意...

JAVA 加载资源文件的问题
答:,再用上面的load方法加载即可。也就是p.load(Tools.class.GetClassLoader().getResourceAsStream(SysCOnstants.SYS_PROPERTYNAME2));即可。2.通过类装载器来装载资源文件,这样就不必写出资源文件的全路径了。3.加载后的资源文件你可以理解成一个map(类似),等号前边的是key,等号后边的是值。

proper的同义词
答:proper的同义词例句: 1. Police have released an E-fit picture of the suspected gunman. 警方已公布持枪嫌犯的电子画像。 2. She made a New Year's resolution to get fit. 她的新年决心是要保持身材健美。 3. There's something about the way he talks of her that doesn't fit. 他谈论她的样子...

关于JAVA代码 求教
答:以下是我加的注释,希望对你有帮助。public void addEntity(Entity entity){ // Preconditions; entity not null assert(entity!=null); //当entity!=null为true时,程序继续执行,否则抛出java.lang.AssertionError,程序终止 // Method proper removeEntity(entity.getEntityID()); //移除指定实体...

java获取远程图片,获取不全
答:用这个吧,这个方法是我从apache commons中扒下来的,没有问题的,记得采纳啊 /** * 从URL抓取一个文件写到本地 * 这个方法摘自 org.apache.commons.io.FileUtils.copyURLToFile(URL source, File destination) * @param source * @param destination * @throws IOException */public static void...

使用getcher函数从键盘输入一个小写字母,输出它对应的大写字母?_百度...
答:getcher拼写错误,应该是 getchar include <stdio.h> int main(){ char c;c=getchar();if(c>='a'&&c<='z')c-=32;printf("%c\n",c);return 0;}

Java如何使用Java创建一个空的PDF文档
答:package com.yiibai;import java.io.IOException;import org.apache.pdfbox.pdmodel.PDDocument;import org.apache.pdfbox.pdmodel.PDPage;// 需要下 apache pdfbox包和apache.commons.loggin乌,下载地址:http://pdfbox.apache.org/download.cgi 和 http://commons.apache.org/proper/commons-logging/...

IT评价网,数码产品家用电器电子设备等点评来自于网友使用感受交流,不对其内容作任何保证

联系反馈
Copyright© IT评价网