Java学习笔记
文章平均质量分 87
坚强的花菜
这个作者很懒,什么都没留下…
展开
-
Java学习笔记(9)Objects and Classes
9.1面向对象编程的基本概念1、面向对象编程(Object-oriented programming, OOP) 是以对象为基本单位来搭建程序的编程方法。术语对象(object)指的是实体(entity),例如学生,桌子,圆,按钮。2、对象具有唯一的标识,状态和行为。对象状态由一组数据域data fields(或属性properties)构成,对象的行为behavior则是由一组方法构成。翻译 2016-06-23 09:39:39 · 3222 阅读 · 0 评论 -
Java学习笔记(4)Mathematical Functions, Characters, and Strings
4.2 Common Mathematical Functions两个预定义常量:Math.PI,Math.E4.2.1 Trigonometric MethodsMethod Descriptionsin(radians) Returns the trigonometric sine of an angle in radi翻译 2016-06-23 00:52:01 · 1165 阅读 · 0 评论 -
Java学习笔记(5)Loops
5.2 The while Loopwhile (loop-continuation-condition) { // loop-body; Statement(s);}5.2.1 Case Study: Guessing NumbersLISTING5.3 GuessNumber.java import java.util.Scanner; publi翻译 2016-06-23 01:01:21 · 1741 阅读 · 0 评论 -
Java学习笔记(6)Methods
6.2 Defining a MethodA method definition consists of its method name, parameters, return value type, and body.value-returning method: If a method returns a value, it is called avalue-returning翻译 2016-06-23 01:17:07 · 3342 阅读 · 0 评论 -
Java学习笔记(11)Inheritance and Polymorphism
11.1超类(Superclass)和子类(Subclasses)对一个已有的类做扩充,叫做继承。被继承的那个已有类叫做超类(superclass),新的那个类叫子类(subclass)。继承性是面向对象的第二个特性。有些面向对象的语言把超类叫做父类,把子类叫做派生类,意思是一样的。例子,先画UML图: LISTING 11.1 SimpleGeometricObject.翻译 2016-06-23 10:42:55 · 4665 阅读 · 0 评论 -
Java学习笔记(12)Exception Handling and Text I/O
12.1异常的一个例子:运行时错误( runtime error )import java.util.Scanner;public class Quotient { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter tw翻译 2016-06-23 11:20:31 · 1104 阅读 · 0 评论 -
Java学习笔记(13)Abstract Classes and Interfaces
13.1.1为何需要抽象方法前面章节中我们定义过这三个类:GeometricObject,Circle和Rectangle,其中Circle和Rectangle都有这两个方法: getArea()和getPerimeter()。考虑到求面积和求周长应该是几何物体的共性,因此将这两个方法定义在GeometricObject是合适的。但是问题在于, GeometricObject只是一个抽象概翻译 2016-06-23 11:43:24 · 2318 阅读 · 0 评论 -
Java学习笔记(14.1)JavaFX Basics
翻译 2016-06-23 12:25:51 · 653 阅读 · 0 评论 -
Java学习笔记(14.2)JavaFX Basics
翻译 2016-06-23 12:30:00 · 478 阅读 · 0 评论 -
Java学习笔记(15)Event-Driven Programming and Animations 事件驱动编程与动画
翻译 2016-06-23 13:00:16 · 1152 阅读 · 0 评论 -
Java学习笔记(16)JavaFX UI Controls and Multimedia JavaFX UI控件和多媒体
翻译 2016-06-23 13:02:17 · 1203 阅读 · 0 评论 -
Java学习笔记(21) sets and maps
21.1 IntroductionA set is an efficient data structure for storing and processing nonduplicate elements.A map is like a dictionary that provides a quick lookup to retrieve a value using a key.翻译 2016-07-19 22:44:34 · 1889 阅读 · 0 评论 -
Java学习笔记(3)Selections
3.2 boolean Data TypeThe booleandata type declares a variable with the value eithertrue orfalse.A variable that holds a Boolean value is known as a Boolean variable. Theboolean data type i翻译 2016-06-23 00:33:39 · 1322 阅读 · 0 评论 -
Java学习笔记(2)the Additional Part
Method for Scanner ObjectsMethod DescriptionnextByte() reads an integer of thebyte type.nextShort() reads an integer of theshort type.nextInt() reads a翻译 2016-06-23 00:24:25 · 830 阅读 · 0 评论 -
Java学习笔记(1)Introduction to Computers, Programs, and Java
学习教材为《Introducition to Java Programming》。Chapter1 Introduction to Computers, Programs, and Java1.2 What is Computer?A computer consists of the following major hardware components (Figure 1.1翻译 2016-06-23 00:19:02 · 1105 阅读 · 0 评论 -
Java学习笔记(17) Binary I/O
17.1 Introduction1、Files can be classified as eithertext or binary.(文件可以被归类为文本文件和二进制文件)2、A file that can be processed (read, created, or modified) using a text editor such as Notepad on Window翻译 2016-06-24 14:20:24 · 4964 阅读 · 0 评论 -
java学习笔记(18)Recursion
翻译 2016-06-25 17:54:09 · 733 阅读 · 0 评论 -
Java学习笔记(19)Generics
翻译 2016-06-29 15:45:40 · 439 阅读 · 0 评论 -
Java学习笔记(20) Lists, Stacks, Queues, and Priority Queues
20.1 Introduction In object-oriented thinking, a data structure, also known as acontainer or container object, is an object that stores other objects, referred to as data or elements. To d翻译 2016-06-30 13:42:57 · 2610 阅读 · 2 评论 -
Java学习笔记(22)Developing Efficient Algorithms
翻译 2016-07-24 22:05:46 · 788 阅读 · 0 评论 -
Java学习笔记(23) Sorting
23.1IntroductionThe data to be sorted might be integers, doubles,characters, or objects.The Java API contains severaloverloaded sort methods for sorting primitive type values and objects in thej翻译 2016-07-28 15:12:29 · 682 阅读 · 0 评论 -
Java学习笔记(24)Implementing Lists,Stacks,Queues,and Priority Queues
12 publicbooleancontains(E e);1314 /** Return the element from this list at thespecified index */15 publicE get(int index);1617 /** Return the index of the first matchingel翻译 2016-07-28 15:25:40 · 942 阅读 · 0 评论 -
Java学习笔记(25)Binary Search Trees
翻译 2016-07-28 15:31:23 · 906 阅读 · 0 评论 -
Java学习笔记(8)Multidimensional Arrays
8.2.1 Declaring Variables of Two-Dimensional Arrays and Creating Two-Dimensional Arrays// 二维数组声明dataType[][] refVar; // 创建二维数组refVar = new dataType[10][10]; // 可以把上面的两步合成一步dataType[][] ref翻译 2016-06-23 09:17:38 · 2980 阅读 · 0 评论 -
Java学习笔记(7)Single-Dimentional Arrays
7.2 Array Basics数组是一组相同类型数据的集合。你不需要关心这些数据在内存中如何排列,因为Java不能通过地址访问元素。7.2.1 Declaring Array Variablesdatatype[] arrayRefVar; //推荐写法例如: double[] myList; //声明myList是数组变量(指针,在Stack中),但是目前数组为null,还翻译 2016-06-23 08:29:27 · 2058 阅读 · 0 评论 -
Java学习笔记(10)Object-Oriented Thinking
10.1 Class Abstraction and Encapsulation类抽象和封装类抽象指的是将一个类的具体实现和类的使用做一个分离。作为类的创建者,他只需要提供这个类的描述,以便让使用者知道如何使用这个类;作为类的使用者,他不需要知道这个类的内部如何实现,也无从知道这个类如何实现。 看一个例子来感受类封装显然,即便你不知道如何Stage类是怎么做出来的,不妨碍你翻译 2016-06-23 10:05:28 · 2595 阅读 · 0 评论 -
Java学习笔记(26) AVL Trees
翻译 2016-07-31 10:07:03 · 1018 阅读 · 1 评论