Road Java based learning, - notes day1

Road JavaJ based learning, day1

A .java language background
1. In 1995 sun has introduced computer language, in 2009 was acquired by ORACLE Oracle Corporation.
Two, JRE, JDK, JVM
developed in three steps:
1. Write code
2. Compile the code javac file name .java
3. Run the code java file name

1.JRE: JRE is java runtime environment (Java Runtime Environment)
contains JVM java virtual machine and core class libraries.
Java core libraries: very central code repository
class: a = a java file class
library: store multiple java file repository
2.JDK (Java Develop Kit) in Java, software development tools, including the compiler and runtime tools to .
3.JVM is an acronym for Java Virtual Machine (Java virtual machine), JVM itself does not allow cross-platform, cross-platform that allows Java programs.
Cross-platform Java language is because with a different versions on different operating systems Java virtual machine, the virtual machine can recognize the Java bytecode.
Here Insert Picture Description
Here Insert Picture Description

Three, Path environment variable configuration

Computer - Right - Properties - Advanced System Settings - environment variables
in the system variable, select New
Here Insert Picture Description
configuration% JAVA_HOME% \ bin in your path; the best place it on the front, to avoid the emergence of javac and java version different issues
Here Insert Picture Description
Fourth, programming

//class定义一个类,后面跟类名,通过public对类名进行限制,限制类名和文件名必须保持一致
public class HelloWorld{
//main作为程序的入口点,main方法,也叫主方法,如果没有编写主方法,程序就找不到入口点,编译会出现错误
	public static void main(String[] args){
	//可以在控制台打印双引号包裹的内容,要打印多行内容,就编写多条语句
		System.out.println("HelloWorld");
	}
		
}
System.out.println("");双引号中间可以为空;	System.out.println(‘’);单引号中间不能为空报错;
System.out.println();具有换行的效果
public class ConstantDemo{
	/*
		常量:在程序执行过程中是不会发生变化的量
		常量分类:
			字符串常量:被双引号包裹的内容都是字符串常量
			字符常量:被单引号包裹的内容,注意:单引号只能存放一个字符
			整数常量:所以整数
			小数常量:所以小数
			布尔常量:true false
			空常量:null
			
	
	*/
		public static void main(String[] args){
			//字符串常量
			System.out.println("HelloWorld!!");
			System.out.println("---------");
			
			//整数常量
			System.out.println(678);
			System.out.println("----------");
			
			//小数常量
			System.out.println(1.154);
			System.out.println("---------");
			
			//字符常量
			System.out.println('A');
			System.out.println("--------");
			
			//布尔常量
			System.out.println(true);
			System.out.println(false);
			
			//空常量 是不能直接输出的
			//Syestem,out.println(null)
		}
Published 12 original articles · won praise 2 · Views 1948

Guess you like

Origin blog.csdn.net/ytzang/article/details/104263440