basic c java_Java-basic-1

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);

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值