Skip to content

Commit

Permalink
Save
Browse files Browse the repository at this point in the history
  • Loading branch information
stden committed May 27, 2015
1 parent 56b0072 commit 7968b25
Show file tree
Hide file tree
Showing 50 changed files with 226 additions and 1,262 deletions.
56 changes: 49 additions & 7 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .~lock.java.ppt#
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
denis stepulenok,STEPULENOK-PC/gtee,STEPULENOK-PC.ru.oracle.com,21.05.2015 20:35,file:///C:/Users/gtee/AppData/Roaming/OracleOpenOffice/3;
1 change: 1 addition & 0 deletions 00_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ http://openjdk.java.net/jeps/200

Установка и настройка IntelliJ IDEA, создание проекта
-----------------------------------------------------
* http://habrahabr.ru/post/112749/ - Почему IDEA лучше Eclipse
* https://www.jetbrains.com/idea/download/ - Idea Ultimate Edition + серийный номер
* Указать **JDK** в настройках проекта (обычно каталог:
**C:\Program Files\Java\jdk1.8.0_20**).
Expand Down
10 changes: 6 additions & 4 deletions 01_HelloWorld/src/main/java/p01_datatypes/A_PrimitiveTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public static void main(String args[]) {
// 4. 64-битное целое **long**
long l = 2147483648L; // 64-битное целое
System.out.println("l = " + l);
long l2 = 10000000000L;
System.out.println("l2 = " + l2);

byte b1 = (byte) 0xff;
System.out.println("b1 = " + b1);
Expand Down Expand Up @@ -128,10 +130,10 @@ public static void main(String args[]) {
System.out.println("a = " + a);
// Условный оператор **if**
//-->
if (a > 1) { // Когда условие истинно
if (a > 1 && a < 10) { // Когда условие истинно
System.out.println("a большая :)");
} else { // в противоположном случае
System.out.println("a маленькая :)");
System.out.println("a маленькая или очень большая");
}
//<--

Expand Down Expand Up @@ -175,10 +177,10 @@ public static void main(String args[]) {
a++; // Постфиксная форма
System.out.println("a = " + a);
a = 2;
int aa = a++; // aa = 2
int aa = a++ + a++; // aa = 4
System.out.println("aa = " + aa);
// a = 3
int a1 = ++a; // a1 = 4, a = 4
int a1 = ++a;
System.out.println("a1 = " + a1);
++a; // Префиксная форма
// Декремент
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static void main(String[] args) {
double b = 0.6;
double c = 0.9;
// Корректная проверка что a + b == c
if (Math.abs(c - (a + b)) < 0.00000000001) {
if (Math.abs(a + b - c) < 1e-15) {
System.out.println("Равно");
} else {
System.out.println("Не равно!");
Expand Down
2 changes: 1 addition & 1 deletion 01_HelloWorld/src/main/java/p01_datatypes/D_Arrays.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void main(String[] args) {
{4, 5, 6},
{7, 8, 9}
};
int x = array2D[0][0]; // Элемент массива с индексом 0 0
int x = array2D[0][1]; // Элемент массива с индексом 0 1
array2D[1][1] = 231; // Новое значение
//<--
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,28 @@ public static void main(String[] args) {
//-->
int i = 10;
assertEquals("Перед вызовом method1", 10, i);
System.out.println("Перед вызовом method1 i = " + i);
method1(i);
assertEquals("После вызова method1", 10, i);
System.out.println("После вызова method1 i = " + i);
//<--

//-->
MyClass object = new MyClass();
object.i = 10;
assertEquals("Перед вызовом method2", 10, object.i);
System.out.println("Перед вызовом method2 object.i = " + object.i);
myMethod2(object);
assertEquals("После вызова myMethod2", 30, object.i);
System.out.println("После вызова method2 object.i = " + object.i);
//<--
}

// i значение копируется
//-->
static void method1(int i) {
i += 20;
System.out.println("method1: i = " + i);
assertEquals("method1: ", 30, i);
}
//<--
Expand Down
3 changes: 3 additions & 0 deletions 01_HelloWorld/src/main/java/p01_datatypes/I_Printf.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public static void main(String[] args) {
// 3 символа на каждое число
System.out.printf("%3d\n", i);

int myIntVar = 10;
System.out.printf("myIntVar = %d%n", myIntVar);

for (int x = 1; x < 10; x++) {
for (int y = 1; y < 10; y++) {
String s = String.format(" %3d", x * y);
Expand Down
2 changes: 1 addition & 1 deletion 02_OOP/02_OOP.iml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
Expand Down
4 changes: 2 additions & 2 deletions 02_OOP/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ AbstractClass

Первый интерфейс
``` java
public interface I {
public interface I1 {
void m1();
}
```

[src/main/java/multi/I.java](src/main/java/multi/I.java)
[src/main/java/multi/I1.java](src/main/java/multi/I1.java)

``` java
// Без модификатора
Expand Down
16 changes: 16 additions & 0 deletions 02_OOP/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,20 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
8 changes: 0 additions & 8 deletions 02_OOP/src/main/java/multi/A.java

This file was deleted.

9 changes: 0 additions & 9 deletions 02_OOP/src/main/java/multi/B.java

This file was deleted.

17 changes: 0 additions & 17 deletions 02_OOP/src/main/java/multi/C.java

This file was deleted.

50 changes: 49 additions & 1 deletion 02_OOP/src/main/java/multi/Demo.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,69 @@
*
*/
public class Demo {
static public class A {
public int a = 1;

public int getA() {
return a;
}
}

// B - наследник A
static public class B extends A {
public int a = 2;
public int b;
}

// Первый интерфейс
//-->
public interface I1 {
void m1();
}
//<--

// A
// / \
// B C
// \ /
// D
public interface I2 {
void m1();

default void m2(){
System.out.println("Default implementation");
}
}

static public class C extends A implements I1, I2 {
@Override
public void m1() {
System.out.println("C.m1");
}

@Override
public void m2() {
System.out.println("C.m2");
}
}

public static void main(String[] args) {
A a = new A();
B b = new B();
System.out.println("b.a = " + b.a);
System.out.println("b.getA() = " + b.getA());
b.a = 1;
b.b = 2;

C c = new C();
c.m1();
c.m2();

I i1 = c;
I1 i1 = c;
i1.m1();

I2 i2 = c;
i2.m1();
i2.m2();

//AbstractClass
Expand Down
8 changes: 0 additions & 8 deletions 02_OOP/src/main/java/multi/I.java

This file was deleted.

8 changes: 0 additions & 8 deletions 02_OOP/src/main/java/multi/I2.java

This file was deleted.

3 changes: 3 additions & 0 deletions 02_OOP/src/main/java/shapes/Circle.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
* Круг
*/
public class Circle extends Shape {
/**
* Радиус
*/
private double r;

/**
Expand Down
Loading

0 comments on commit 7968b25

Please sign in to comment.