Java 课堂笔记 01

设置环境变量:
在cmd里面用set命令只是暂时改变cmd环境下的环境变量(局部或系统),退出此次cmd后消失。需要永久设置环境变量必须在“系统属性-->高级-->环境变量”里设置(新建、编辑)。
set JAVA_HOME=F:/Java/jdk1.6.0_02
set PATH=%JAVA_HOME%/bin;%PATH%
set CLASSPATH=.;%JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar

课堂笔记:
1、执行.class文件需要安装JRE,编写并生成.class文件需要JDK. XP 与 SUN 签有协议,在安装XP等时,已经安装好了JRE.所以IE 能直接运行网页的applet程序.
每一个java 代码里的一个类经过编译都会生成一个.class文件.

2、 JAVA 里所有关键字都是小写, Java 大小写敏感

3、You can use the 2> shell operator to redirect the errors to a file:javac MyProg.java 2> errors.txt.

4、   <applet code="WelcomeApplet.class" width="400" height="200">
         <param name="greeting" value ="Welcome to Core Java!"/>
      </applet>
The applet viewer ignores all HTML tags except for the applet tag.

5、lib :  都是.class 文件,相应的java文件在src里.   .jar ( API 存放的地方 )

6、The applet viewer has no capabilities to send mail or display a web page, so it ignores your requests. The applet viewer is good for testing applets in isolation, but you need to put applets inside a browser to see how they interact with the browser and the Internet.

7、The keyword public is called an access modifier; these modifiers control the level of access other parts of a program have to this code.

8、class 名称习惯: use an initial uppercase letter in each of the words.
You need to make the file name for the source code the same as the name of the public class, with the extension .java appended.

9、The point to remember for now is that every Java application must have a main method that is declared in the following way:
public class ClassName
{
   public static void main(String[] args)
   {
      program statements
   }
}

10、If the main method exits normally, the Java program has the exit code 0, indicating successful completion. To terminate the program with a different exit code, use the System.exit() method.

11、In Java you must have a shell class for the main method.You may also be familiar with the idea of static member functions in C++. These are member functions defined inside a class that do not operate on objects.

12、/* */ comments do not nest in Java. That is, you cannot deactivate code simply by surrounding it with /* and */ because the code that you want to deactivate might itself contain a */ delimiter.

13、Whenever you use a class that is not defined in the basic java.lang package, you need to use an import directive.

14、Java 里的内部块和外部块不允许重名,即不存在C++中的名字覆盖。

15、a=10011101; b=00111001;则有如下结果:
   a>>3 =11110011 a>>>3=00010011

16、byte  : 8
char  short : 16
float int  :32
double long :64
boolean : 1, 只有 true ,false,不能和数值进行运算。

17、&& : ture 或者 false
^ : 按位运算 0 , 1;
% :  C++ 中左右操作数都必须为整数。 而Java中不是。如 9.5%5.2 is 4.5;
运算符 << 不能应用于 java.lang.String,int。 因为 1<<2 不能直接在 println() 里面用 + 连接, 需要加括号 +( 5<<2 ); 浮点数不能移位; 移位过程是整数值的补码进行移位,然后再转成原码显示。 1>>2 is 0; 3>>1 is 1.
short s = 10; 常量整数当不超过表示范围时往short, byte 时不需要强制类型转换。
byte bt=(byte)300; 采用截断处理。300( 100101100) --> 44(00101100)

18、+ 号运算时,比int 精度小时,会自动提升为int,运算。如 short a=2, b = 3, c;  c = a+b; (1 错误:可能损失精度)。 需要 c =(byte)(a+b);
pritnln( "a" + );错误!!! 中的 + 必须至少连接一个字符串的变量。
java 中的浮点数运算不精确的。
Java 象C++一样随用随定义,但为了可读性最好集中定义。
switch( expression ) 只能是 char , 整型。
for()循环中的临时 i 出了for循环就没了。
始终注意 if if 与 if else (if) 的区别!!!
while()  在条件判断循环的优势

Java学习之我见 笔记:
编程的唯一途径: 背(习惯成自然)

使用插件的前提:编程语言熟悉
中间件
SQL 语句,常用函数
XML 解析问题
面向对象的抽象能力:封装-->继承-->多态 《 抽象类和接口(设计)》 《Java与模式》

Java SE 的应用部分:
多线程:实现、区别、同步
IO操作:字节流、字符流、序列化
类集:Map Collection List Set

关于设计模式:
单例设计 (只能从内部产生对象,然后通过静态方法传出)如回收站
工厂设计 --> Class 类
代理设计(静态+动态) -->代理类-->真实的一个类的实现
模板设计 Servlet

JSP/Servlet (前台:客户端)--> 《 JSP 2.0 技术手册》
HTML、JavaScript (美工):几个事件操作
以JAVA的概念去理解JSP应用 :
MVC
JDBC
分页-->组件
上传、打印图表、报表打印

RMI/EJB/Web Service
RMI、EJB 运行机制及组成
EJB 3.0 ( 大、贵, 主要是讨论标准 )
WebSphere WebLogic 怎么用

框架(没必要背)
MVC 框架: Structs+WebWork、JSF(JSTL)、Tapestry
ORMapping框架: Hibernate
架构框架: Spring --> 大工厂(大模式) --> 容器、Ioc
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值