Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
011 added sources for arrays, continuing with chapter 5
- Loading branch information
Showing
98 changed files
with
186 additions
and
8 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified
0
chapter00/src/main/java/com/apress/bgn/ch0/service/NakedService.java
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified
0
chapter01/src/main/java/com/apress/bgn/ch1/service/Provider.java
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified
0
chapter03/src/main/java/com/apress/bgn/ch3/byeworld/GoodBye.java
100644 → 100755
Empty file.
Empty file modified
0
chapter03/src/main/java/com/apress/bgn/ch3/byeworld/package-info.java
100644 → 100755
Empty file.
Empty file modified
0
chapter03/src/main/java/com/apress/bgn/ch3/helloworld/Hello.java
100644 → 100755
Empty file.
Empty file modified
0
chapter03/src/main/java/com/apress/bgn/ch3/helloworld/package-info.java
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/basic/BasicHumanDemo.java
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/basic/Musician.java
100644 → 100755
Empty file.
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/ex/EmptyPerformerException.java
100644 → 100755
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/ex/ExceptionsDemo.java
100644 → 100755
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/ex/PerformerGenerator.java
100644 → 100755
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/gen/GenericsDemo.java
100644 → 100755
Empty file.
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/hierarchy/Actor.java
100644 → 100755
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/hierarchy/Artist.java
100644 → 100755
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/hierarchy/BasicHumanDemo.java
100644 → 100755
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/hierarchy/Gender.java
100644 → 100755
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/hierarchy/Human.java
100644 → 100755
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/hierarchy/Musician.java
100644 → 100755
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/hierarchy/Performer.java
100644 → 100755
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/hierarchy/Sample.java
100644 → 100755
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/lambda/Addition.java
100644 → 100755
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/lambda/Operation.java
100644 → 100755
Empty file.
Empty file modified
0
chapter04/src/main/java/com/apress/bgn/ch4/lambda/OperationDemo.java
100644 → 100755
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
plugins { | ||
id 'java-library' | ||
} | ||
|
||
/* module with primitive types examples */ | ||
ext.moduleName = 'chapter.five.arrays' | ||
|
||
jar { | ||
manifest { | ||
attributes( | ||
"Created-By": System.getProperty('java.version'), | ||
"Specification-Title": "Java for Absolute Beginners", | ||
"Main-Class": "com.apress.bgn.ch5.CollectionsDemo", | ||
"Implementation-Version": version, | ||
"Class-Path": configurations.compile.collect { it.getName() }.join(' ') | ||
) | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
chapter05/arrays/src/main/java/com/apress/bgn/ch5/ArraysDemo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
Freeware License, some rights reserved | ||
Copyright (c) 2018 Iuliana Cosmina | ||
Permission is hereby granted, free of charge, to anyone obtaining a copy | ||
of this software and associated documentation files (the "Software"), | ||
to work with the Software within the limits of freeware distribution and fair use. | ||
This includes the rights to use, copy, and modify the Software for personal use. | ||
Users are also allowed and encouraged to submit corrections and modifications | ||
to the Software for the benefit of other users. | ||
It is not allowed to reuse, modify, or redistribute the Software for | ||
commercial use in any way, or for a user's educational materials such as books | ||
or blog articles without prior permission from the copyright holder. | ||
The above copyright notice and this permission notice need to be included | ||
in all copies or substantial portions of the software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
package com.apress.bgn.ch5; | ||
|
||
import java.util.Arrays; | ||
|
||
/** | ||
* @author Iuliana Cosmina | ||
* since 1.0 | ||
*/ | ||
public class ArraysDemo { | ||
|
||
int array[]; | ||
|
||
public static void main(String... args) { | ||
ArraysDemo ad = new ArraysDemo(); | ||
if (ad.array == null) { | ||
System.out.println("array unusable"); | ||
} | ||
|
||
// after proper initialization | ||
ad.array = new int[2]; | ||
for (int i = 0; i < ad.array.length; ++i) { | ||
System.out.println("array["+ i +"]= " + ad.array[i]); | ||
} | ||
// setting elements explicitly | ||
|
||
ad.array[0] = 5; | ||
for (int i = 0; i < ad.array.length; ++i) { | ||
System.out.println("array["+ i +"]= " + ad.array[i]); | ||
} | ||
|
||
// define array with direct initialization | ||
int another[] = {1,4,3,2}; | ||
for (int i = 0; i < another.length; ++i) { | ||
System.out.println("array["+ i +"]= " + another[i]); | ||
} | ||
|
||
//sort array | ||
Arrays.sort(another); | ||
for (int i = 0; i < another.length; ++i) { | ||
System.out.println("array["+ i +"]= " + another[i]); | ||
} | ||
|
||
//Arrays.stream(another).forEach(element -> System.out.println(element)); | ||
Arrays.stream(another).forEach(System.out::println); | ||
|
||
// multidimensional array | ||
int[][] intMatrix = {{1,0},{0,1}}; | ||
for (int i = 0; i < intMatrix.length; ++i) { | ||
for (int j = 0; j < intMatrix[i].length ; ++j) { | ||
System.out.print( intMatrix[i][j] + " "); | ||
} | ||
System.out.println(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* Created by iuliana.cosmina on 3/5/18. | ||
*/ | ||
module chapter.five.collections { | ||
} |
Empty file.
Empty file.
Empty file modified
0
chapter05/collections/src/main/java/com/apress/bgn/ch5/CollectionsDemo.java
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file modified
0
chapter05/data-structures/src/main/java/com/apress/bgn/ch5/DataStructuresDemo.java
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file modified
0
chapter05/data-types/src/main/java/com/apress/bgn/ch5/DataTypesDemo.java
100644 → 100755
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file modified
0
chapter05/primitives/src/main/java/com/apress/bgn/ch5/ConvertProcess.java
100644 → 100755
Empty file.
Empty file modified
0
chapter05/primitives/src/main/java/com/apress/bgn/ch5/IntContainer.java
100644 → 100755
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file modified
0
chapter05/primitives/src/main/java/com/apress/bgn/ch5/PrimitivesDemo.java
100644 → 100755
Empty file.
21 changes: 21 additions & 0 deletions
21
chapter05/primitives/src/main/java/com/apress/bgn/ch5/ReferencesDemo.java
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
* Created by iuliana.cosmina on 3/5/18. | ||
*/ | ||
module chapter.five.primitives { | ||
requires chapter.four; | ||
} |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified
0
chapter11/media-handling/src/main/java/com/apress/bgn/ch11/MediaDemo.java
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file modified
0
chapter11/read-write-file/src/main/java/com/apress/bgn/ch11/Demo.java
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file modified
0
chapter11/serialization/src/main/java/com/apress/bgn/ch11/SerializationDemo.java
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters