码迷,mamicode.com
首页 > 编程语言 > 详细

Java-basic-1

时间:2017-03-23 23:35:43      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:pager   hello   device   method   开始   translate   首字母   byte   实例   

1.

Java Standard Edition (Java SE) 

Java Enterprise Edition (Java EE):

geared toward developing large-scale, distributed networking applications and web-based applications
Java Micro Edition (Java ME):
geared toward developing applications for small, memory-constrained devices, such as cell phones, pagers and PDAs.

2. Javadoc comments:

使用/**开始,*/结束;javadoc utility program 读Javadoc来做html文档

3. implicitly imports java.lang,所以不用写

4.

类的命名:每个词的首字母大写:ClassName,不能以数字开头

变量和函数的命名:首词首字母小写,其他首字母大写:variName

5. 

// turn into .class containing Java bytecodes
javac fileName.java
// javac *.java多个java文件同时编译
// translated by JVM for os, execute
java fileName

6. Integer division: 小数部分直接抛弃

7. static method:
不需要创建其实例就可以用。main是static的,而且每个class里都可以有一个main,具体用哪个根据java命令来定。

8.

primitive types:
boolean, byte, char, short, int, long, float, double
reference types:
Objects that are referenced may each contain many instance variables and methods. 不是primitive,就是reference。


 

下面是代码时间:) 

// for dialog window
import javax.swing.JOptionPane;
//Only ONE public
public class test {
	public static void main(String[] args) {
		// Standard output object. to command line
		System.out.print("first");
		// add /n
		System.out.println("Hello world!");
		// format-control
		float i = 3.2f;
		System.out.printf("%s\n%.2f", "Hello", i);
		
		// input dialog window. get input.
		String name = JOptionPane.showInputDialog("what‘s your name?");
		// format control of string
		String msg = String.format("Welcome, %s", name);
		// first: position of window. null = center
		JOptionPane.showMessageDialog(null, msg);
	}
}

  

Java-basic-1

标签:pager   hello   device   method   开始   translate   首字母   byte   实例   

原文地址:http://www.cnblogs.com/pxy7896/p/6607909.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!