Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd710a8f

Browse files
committed
Java第二十四天
1 parent1e09c58 commitd710a8f

File tree

95 files changed

+1341
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1341
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentrykind="src"path="src"/>
4+
<classpathentrykind="con"path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
5+
<classpathentrykind="output"path="bin"/>
6+
</classpath>

‎day24/code/day24_Pattern/.project‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>day24_Pattern</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.7
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.source=1.7
749 Bytes
Binary file not shown.
465 Bytes
Binary file not shown.
749 Bytes
Binary file not shown.
508 Bytes
Binary file not shown.
647 Bytes
Binary file not shown.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
packagecn.itcast_01;
2+
3+
/*
4+
* 设计模式:经验的总结。是一套模型。
5+
*
6+
* 分类:
7+
*创建型模式
8+
*行为型模式
9+
*结构型模式
10+
*
11+
* 单例模式:保证类在内存中只有一个对象。
12+
* 举例:
13+
* windows打印机,网站计数器
14+
*
15+
* 如何能够保证类在内存中只有一个对象呢?
16+
* A:让外界不能创建对象
17+
* 构造私有
18+
* B:本身提供一个对象
19+
* 在成员位置创建对象
20+
* C:对外提供公共的访问方式
21+
* 写一个公共方法即可
22+
*/
23+
publicclassSingletDemo {
24+
publicstaticvoidmain(String[]args) {
25+
// Student s1 = new Student();
26+
// Student s2 = new Student();
27+
// System.out.println(s1 == s2);
28+
29+
// Student.s = null;
30+
31+
Students1 =Student.getStudent();
32+
Students2 =Student.getStudent();
33+
System.out.println(s1 ==s2);
34+
}
35+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
packagecn.itcast_01;
2+
3+
publicclassStudent {
4+
// 构造私有
5+
privateStudent() {
6+
}
7+
8+
// 本身创建
9+
// 静态只能访问静态,加static
10+
// 为了不让外加访问,加private
11+
privatestaticStudents =newStudent();
12+
13+
// 提供公共访问
14+
// 为了让外界可以直接访问,加static
15+
publicstaticStudentgetStudent() {
16+
returns;
17+
}
18+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp