大二上java程序设计期末复习
整理了一下ppt的内容,java程序设计课程的课件。
软件开发(Software Development)
Agile Methodologies(敏捷方法)
这是一种快速部署应用程序的理念,优点包括:
persistent software delivery 持续提交软件
increased stakeholder satisfaction 增加利益方的满意度
inspect and adapt 检查调整
welcome to changes at any stage 支持任意阶段修改
design is important 设计至关重要
daily interaction 日常互动
版本控制(version control)
就是说需要一个git来控制一下版本,对多人合作很方便。而关于这个git的用法可以看看这篇博客 。
JVM
这里多说两句这个JVM,JVM(Java Virtucal Machine)是一个类似虚拟机的玩意,它运行在操作系统之下,通过与操作系统交互达到与硬件交互的目的。知道这个之后我们看看java文件怎么运行,首先写完一个.java文件之后通过编译器编译得到一个.class文件,然后通过类加载器把这个.class丢到JVM里面。这里再多提两句嘴,JVM内主要的五大块:方法区,堆是线程共享区域,有线程安全问题,栈和本地方法栈和计数器是独享区域,不存在线程安全问题。
Java语言基础
语言基础语法
这个去这里看。
UML图
呃就是一个类的图形化表示,举个例子吧~
递归
- Mistakes like omitting the base case or writing the recursion step incorrectly can cause infinite recursion. 小心无限递归爆栈
- Recursive programs may result in exponential method calls 递归可能导致指数级别调用
- Each recursive method can be re-written using loops所有递归可重写为循环
- Use recursive methods only if the problem is naturally recursive (i.e., to improve understanding) or there are performance benefits, or you need to impress in a job interview在必要的时候再用递归
Concurrency in Java (并发)
Complex applications may use multithreading to speed up performance or user experience 复杂的程序会使用多线程来加速性能或用户体验
Caveats of multithreading(多线程注意事项)
- Calling methods from multiple threads may have undesired and unexpected side effects (things may not happen in the expected order) 可能有副作用
- Only primitive variables that are declared final can be shared across threads 只有声明final的变量可以跨线程共享
- Using keyword synchronized will “lock” the method execution and force other threads to wait until the execution completes 使用关键字同步将“锁定”方法的执行,并强制其他线程等待,直到执行完成
- Thread can be in different states. After termination, thread can’t be started again (however, you can create a new thread). 线程终止后不能再次启动,但是可以创建一个新的线程
Exception handling (异常处理)
- An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program’s instructions
- Exception handler is a block of code that can handle the exception
- Java allows to separate exception handling code from the normal code to improve the readability
- Exceptions are propagated across the call stack until exception handler is found so developer can choose at which level exceptions should be handled
- Each organisation will have its own house style on how to write and handle exceptions
主要层次结构如下:
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 si1v3r的狗窝!