diff --git a/jaehong/chapter1/build.gradle b/jaehong/chapter1/build.gradle new file mode 100644 index 0000000..3cae2d7 --- /dev/null +++ b/jaehong/chapter1/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java' +} + +group 'org.example' +version '1.0-SNAPSHOT' + +repositories { + mavenCentral() +} + +dependencies { + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' +} + +test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/jaehong/chapter1/docs/README.md b/jaehong/chapter1/docs/README.md new file mode 100644 index 0000000..275cad2 --- /dev/null +++ b/jaehong/chapter1/docs/README.md @@ -0,0 +1,33 @@ +## 1. calcualtor라는 이름을 갖는 클래스를 텍스트 파일에 한번 만들어보자. 실제 코드를 여러분들이 만들어 실행하는 방법은 다음 장에서 배우니, 원하느 파일에 Clculator 클래스를 만들어보자. + +## 2. 본문에서 살펴본 더하기 외에 빼기, 곱하기, 나누기를 하고, 그 결과를 리턴해주는 메서드를 만들어보자 + +### 1. 클래스가 뭔가요? + +클래스는 추상적인 표현으로는 상태(status) 와 행동을 (behavior) 를 가집니다. 자바에서는 변수(필드) 와 함수(메서드)를 가지고 있으며 자바 내에서 가장 작은 단위입니다. + +### 2. 메서드가 뭔가요? + +메서드는 자바 클래스내에 위치하고 있으며 재사용 가능한 기능입니다. + +### 3. 메서드의 매개 변수는 어디에 적어주나요? + +메서드의 매개변수는 자바 클래스 내부에 위치하고 있으며 타입과 이름을 필요로 합니다. + +``` +public class Example { + public int example( 여기에 위치합니다. ) +} +``` + +### 4. 메서드의 이름 앞에 꼭 적어 줘야 하는 건 뭐죠? + +메서드의 반환 타입을 필요로 합니다. 그 외에 접근 제어자가 붙을 수 있지만 기본적으로 명시하지 않으면 public입니다. + +### 5. 클래스가 갖고 있어야 한다고 한 두 가지가 뭐죠? + +클래스가 가지고 있어야 하는 것은 필드와 메서드입니다. 다른 말로는 상태와 행위가 있습니다. + +### 6. 메서드에서 결과를 돌려주려면 어떤 예약어를 사용해야 하나요? + +자바 메서드에서 결과를 돌려주기 위한 예약어는 `return` 을 사용해야 합니다. \ No newline at end of file diff --git a/jaehong/chapter1/gradle/wrapper/gradle-wrapper.jar b/jaehong/chapter1/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..249e583 Binary files /dev/null and b/jaehong/chapter1/gradle/wrapper/gradle-wrapper.jar differ diff --git a/jaehong/chapter1/gradle/wrapper/gradle-wrapper.properties b/jaehong/chapter1/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ae04661 --- /dev/null +++ b/jaehong/chapter1/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/jaehong/chapter1/gradlew b/jaehong/chapter1/gradlew new file mode 100755 index 0000000..a69d9cb --- /dev/null +++ b/jaehong/chapter1/gradlew @@ -0,0 +1,240 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/jaehong/chapter1/gradlew.bat b/jaehong/chapter1/gradlew.bat new file mode 100644 index 0000000..f127cfd --- /dev/null +++ b/jaehong/chapter1/gradlew.bat @@ -0,0 +1,91 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/jaehong/chapter1/settings.gradle b/jaehong/chapter1/settings.gradle new file mode 100644 index 0000000..ad555c3 --- /dev/null +++ b/jaehong/chapter1/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = 'chapter1' + diff --git a/jaehong/chapter1/src/main/java/org/example/Main.java b/jaehong/chapter1/src/main/java/org/example/Main.java new file mode 100644 index 0000000..18a2006 --- /dev/null +++ b/jaehong/chapter1/src/main/java/org/example/Main.java @@ -0,0 +1,8 @@ +package org.example; + + +public class Main { + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} \ No newline at end of file diff --git a/jaehong/chapter1/src/main/java/org/example/component/Calculator.java b/jaehong/chapter1/src/main/java/org/example/component/Calculator.java new file mode 100644 index 0000000..57d4106 --- /dev/null +++ b/jaehong/chapter1/src/main/java/org/example/component/Calculator.java @@ -0,0 +1,23 @@ +package org.example.component; + +public class Calculator { + public int add(int num1, int num2){ + return num1 + num2; + } + + public int addAll(int num1, int num2, int num3){ + return add(add(num1, num2) , num3); + } + + public int subtract(int num1, int num2){ + return num1 - num2; + } + + public int multiply(int num1, int num2){ + return num1 * num2; + } + + public int divide(int num1, int num2){ + return num1 / num2; + } +} diff --git a/jaehong/chapter2/build.gradle b/jaehong/chapter2/build.gradle new file mode 100644 index 0000000..3cae2d7 --- /dev/null +++ b/jaehong/chapter2/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java' +} + +group 'org.example' +version '1.0-SNAPSHOT' + +repositories { + mavenCentral() +} + +dependencies { + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' +} + +test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/jaehong/chapter2/gradle/wrapper/gradle-wrapper.jar b/jaehong/chapter2/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..249e583 Binary files /dev/null and b/jaehong/chapter2/gradle/wrapper/gradle-wrapper.jar differ diff --git a/jaehong/chapter2/gradle/wrapper/gradle-wrapper.properties b/jaehong/chapter2/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ae04661 --- /dev/null +++ b/jaehong/chapter2/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/jaehong/chapter2/gradlew b/jaehong/chapter2/gradlew new file mode 100755 index 0000000..a69d9cb --- /dev/null +++ b/jaehong/chapter2/gradlew @@ -0,0 +1,240 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/jaehong/chapter2/gradlew.bat b/jaehong/chapter2/gradlew.bat new file mode 100644 index 0000000..f127cfd --- /dev/null +++ b/jaehong/chapter2/gradlew.bat @@ -0,0 +1,91 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/jaehong/chapter2/settings.gradle b/jaehong/chapter2/settings.gradle new file mode 100644 index 0000000..b030ae0 --- /dev/null +++ b/jaehong/chapter2/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = 'chapter2' + diff --git a/jaehong/chapter2/src/main/java/org/example/Main.java b/jaehong/chapter2/src/main/java/org/example/Main.java new file mode 100644 index 0000000..39983c9 --- /dev/null +++ b/jaehong/chapter2/src/main/java/org/example/Main.java @@ -0,0 +1,21 @@ +package org.example; + +import static java.lang.System.out; + +import java.io.Console; +import java.util.Collections; +import java.util.List; +import jdk.internal.misc.SharedSecrets; + +public class Main { + public static void main(String[] args) { + final var console = System.console(); + SharedSecrets.getJavaIOAccess().console(); + + if(console == null){ + out.println("console is null"); + return; + } + console.printf("hello"); + } +} \ No newline at end of file diff --git a/jaehong/chapter2/src/main/java/org/example/component/HelloGodOfJava.java b/jaehong/chapter2/src/main/java/org/example/component/HelloGodOfJava.java new file mode 100644 index 0000000..20c9022 --- /dev/null +++ b/jaehong/chapter2/src/main/java/org/example/component/HelloGodOfJava.java @@ -0,0 +1,6 @@ +package org.example.component; + +public class HelloGodOfJava { + + +} diff --git a/jaehong/chapter3/Calculator.java b/jaehong/chapter3/Calculator.java new file mode 100644 index 0000000..13a0da7 --- /dev/null +++ b/jaehong/chapter3/Calculator.java @@ -0,0 +1,11 @@ +public class Calculator{ + + public static void main(String ...args){ + System.out.println("calculator class started"); + } + + public int add(int a, int b) {return a+b;} + public int substract(int a,int b) {return a - b;} + public int multiply(int a, int b) {return a * b;} + public int divide(int a, int b) {return a / b;} +} diff --git a/jaehong/chapter3/Car.class b/jaehong/chapter3/Car.class new file mode 100644 index 0000000..4ffa0d4 Binary files /dev/null and b/jaehong/chapter3/Car.class differ diff --git a/jaehong/chapter3/Car.java b/jaehong/chapter3/Car.java new file mode 100644 index 0000000..8cc8262 --- /dev/null +++ b/jaehong/chapter3/Car.java @@ -0,0 +1,24 @@ +public class Car{ + private int speed; + private int distance; + private String color; + + + public void speedUp(){ + this.speed += 5; + // + } + + public void breakDown(){ + this.speed -= 10; + + } + + public int getCurrentSpeed(){ + return speed; + } + @Override public String toString(){ + return "hello"; + } + +} diff --git a/jaehong/chapter3/CarManager.class b/jaehong/chapter3/CarManager.class new file mode 100644 index 0000000..525a3a5 Binary files /dev/null and b/jaehong/chapter3/CarManager.class differ diff --git a/jaehong/chapter3/CarManager.java b/jaehong/chapter3/CarManager.java new file mode 100644 index 0000000..ab191e2 --- /dev/null +++ b/jaehong/chapter3/CarManager.java @@ -0,0 +1,14 @@ + +public class CarManager{ + + public static void main(String ...args){ + // 앞으로 여기에 코드가 들어감 + Car dogCar = new Car(); + dogCar.speedUp(); + dogCar.speedUp(); + + System.out.println(dogCar.getCurrentSpeed()); + dogCar.breakDown(); + System.out.println(dogCar.getCurrentSpeed()); + } +} diff --git a/jaehong/chapter3/Children.class b/jaehong/chapter3/Children.class new file mode 100644 index 0000000..86e51f6 Binary files /dev/null and b/jaehong/chapter3/Children.class differ diff --git a/jaehong/chapter3/Children.java b/jaehong/chapter3/Children.java new file mode 100644 index 0000000..24f704c --- /dev/null +++ b/jaehong/chapter3/Children.java @@ -0,0 +1,5 @@ + +public class Children extends Parent{ + +} + diff --git a/jaehong/chapter3/Initialize.class b/jaehong/chapter3/Initialize.class new file mode 100644 index 0000000..51a7fc6 Binary files /dev/null and b/jaehong/chapter3/Initialize.class differ diff --git a/jaehong/chapter3/Initialize.java b/jaehong/chapter3/Initialize.java new file mode 100644 index 0000000..b6aa909 --- /dev/null +++ b/jaehong/chapter3/Initialize.java @@ -0,0 +1,10 @@ + +public class Initialize{ + private int a; + private int b; + + public Initialize(){ + this.a = 1; + System.out.println(b); + } +} diff --git a/jaehong/chapter3/Parent.class b/jaehong/chapter3/Parent.class new file mode 100644 index 0000000..a310282 Binary files /dev/null and b/jaehong/chapter3/Parent.class differ diff --git a/jaehong/chapter3/Parent.java b/jaehong/chapter3/Parent.java new file mode 100644 index 0000000..e39a4f5 --- /dev/null +++ b/jaehong/chapter3/Parent.java @@ -0,0 +1,3 @@ +public class Parent{ + +} diff --git a/jaehong/chapter3/Sample.js b/jaehong/chapter3/Sample.js new file mode 100644 index 0000000..121e77f --- /dev/null +++ b/jaehong/chapter3/Sample.js @@ -0,0 +1,8 @@ + +class Sample{ + +} + +const sample = new Sample(); + +console.log(typeof sample); diff --git "a/jaehong/chapter5/\"Sample.java\"" "b/jaehong/chapter5/\"Sample.java\"" new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/--help b/jaehong/chapter5/--help new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/ b/jaehong/chapter5/ new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/ b/jaehong/chapter5/ new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/CompareInteger.java b/jaehong/chapter5/CompareInteger.java new file mode 100644 index 0000000..5ebd10e --- /dev/null +++ b/jaehong/chapter5/CompareInteger.java @@ -0,0 +1,12 @@ +public class CompareInteger{ + + + public static void main(String...args){ + + Integer i; + if(i == 42){ + System.out.println(42); + + } + } +} diff --git a/jaehong/chapter5/Compiled b/jaehong/chapter5/Compiled new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/Direction.class b/jaehong/chapter5/Direction.class new file mode 100644 index 0000000..99af3be Binary files /dev/null and b/jaehong/chapter5/Direction.class differ diff --git a/jaehong/chapter5/OperatorCasting.java b/jaehong/chapter5/OperatorCasting.java new file mode 100644 index 0000000..97bc3da --- /dev/null +++ b/jaehong/chapter5/OperatorCasting.java @@ -0,0 +1,29 @@ + +public class OperatorCasting{ + public static void main(String ...args){ + var operator = new OperatorCasting(); + operator.casting(); + } + + public void casting(){ + + byte byteValue = 127; + short shortValue = byteValue; + + shortValue++; + System.out.println(shortValue); + + byteValue=(byte)shortValue; + + System.out.println(byteValue); + + byte s1 = (byte)((int) 9); + byte s2 = (byte)((int) 10); + + System.out.println(s1); + System.out.println(s2); + System.out.println(((byte) Long.MAX_VALUE)); + + + } +} diff --git a/jaehong/chapter5/OperatorMultipleDivision.java b/jaehong/chapter5/OperatorMultipleDivision.java new file mode 100644 index 0000000..9b41a6a --- /dev/null +++ b/jaehong/chapter5/OperatorMultipleDivision.java @@ -0,0 +1,21 @@ +public class OperatorMultipleDivision{ + + public static void main(String...args){ + + OperatorMultipleDivision sample = new OperatorMultipleDivision(); + sample.multipleDivision(); + } + + + public void multipleDivision(){ + + int intValue1 =5; + int intValue2 =10; + + int result = intValue1 * intValue2; + System.out.println(result); + result = intValue2 / intValue1; + System.out.println(result); + + } +} diff --git a/jaehong/chapter5/OperatorPlusMinus.java b/jaehong/chapter5/OperatorPlusMinus.java new file mode 100644 index 0000000..a67f600 --- /dev/null +++ b/jaehong/chapter5/OperatorPlusMinus.java @@ -0,0 +1,19 @@ +public class OperatorPlusMinus{ + + public static void main(String ...args){ + OperatorPlusMinus sample = new OperatorPlusMinus(); + sample.additive(); + } + + public void additive(){ + int intValue1 = 5; + int intValue2 = 10; + + int result=intValue1 + intValue2; + + System.out.println(result); + result = intValue2 - intValue1; + + System.out.println(result); + } +} diff --git a/jaehong/chapter5/OperatorTilde.java b/jaehong/chapter5/OperatorTilde.java new file mode 100644 index 0000000..d667eb2 --- /dev/null +++ b/jaehong/chapter5/OperatorTilde.java @@ -0,0 +1,12 @@ +public class OperatorTilde{ + + public static void main(String ...args){ + int num = 1; + int a = num++ + --num; + System.out.println(a); + + + final var result = OperatorTilde > OperatorTilde; + + } +} diff --git a/jaehong/chapter5/Sample b/jaehong/chapter5/Sample new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/Sample$1.class b/jaehong/chapter5/Sample$1.class new file mode 100644 index 0000000..0b0188f Binary files /dev/null and b/jaehong/chapter5/Sample$1.class differ diff --git a/jaehong/chapter5/Sample(); b/jaehong/chapter5/Sample(); new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/Sample.class b/jaehong/chapter5/Sample.class new file mode 100644 index 0000000..d0ba55c Binary files /dev/null and b/jaehong/chapter5/Sample.class differ diff --git a/jaehong/chapter5/Sample.java b/jaehong/chapter5/Sample.java new file mode 100644 index 0000000..f442c78 --- /dev/null +++ b/jaehong/chapter5/Sample.java @@ -0,0 +1,42 @@ +public class Sample{ + + public static void main(String...args){ + System.out.println(ifStatement(Direction.TOP)); + System.out.println(ifStatement(Direction.BOTTOM)); + System.out.println(ifStatement(Direction.LEFT)); + System.out.println(ifStatement(Direction.RIGHT)); + } + + public static int ifStatement(Direction dr){ + if(dr == Direction.TOP){ + return 1; + } + if(dr == Direction.BOTTOM){ + return 2; + } + if(dr == Direction.LEFT){ + return 3; + } + if(dr == Direction.RIGHT){ + return 4; + } + return 0; + } + + public static int switchStatement(Direction dr){ + return switch(dr){ + case TOP -> 1; + case BOTTOM -> 2; + case LEFT -> 3; + case RIGHT -> 4; + }; + } +} + + +enum Direction{ + TOP, + BOTTOM, + LEFT, + RIGHT; +} diff --git a/jaehong/chapter5/Usage: b/jaehong/chapter5/Usage: new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/a b/jaehong/chapter5/a new file mode 100644 index 0000000..b28731d Binary files /dev/null and b/jaehong/chapter5/a differ diff --git a/jaehong/chapter5/a.txt b/jaehong/chapter5/a.txt new file mode 100644 index 0000000..29b622e --- /dev/null +++ b/jaehong/chapter5/a.txt @@ -0,0 +1,207 @@ +Classfile /Users/jaehong/Documents/java-basic-1/jaehong/chapter5/Sample.class + Last modified 2023. 4. 17.; size 1046 bytes + SHA-256 checksum 0ed37afb8327701d44e6d0c60e64743dd2622cb7b80a8df03d84081ff0e419f9 + Compiled from "Sample.java" +public class Sample + minor version: 0 + major version: 62 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #20 // Sample + super_class: #2 // java/lang/Object + interfaces: 0, fields: 0, methods: 4, attributes: 3 +Constant pool: + #1 = Methodref #2.#3 // java/lang/Object."":()V + #2 = Class #4 // java/lang/Object + #3 = NameAndType #5:#6 // "":()V + #4 = Utf8 java/lang/Object + #5 = Utf8 + #6 = Utf8 ()V + #7 = Fieldref #8.#9 // java/lang/System.out:Ljava/io/PrintStream; + #8 = Class #10 // java/lang/System + #9 = NameAndType #11:#12 // out:Ljava/io/PrintStream; + #10 = Utf8 java/lang/System + #11 = Utf8 out + #12 = Utf8 Ljava/io/PrintStream; + #13 = Fieldref #14.#15 // Direction.TOP:LDirection; + #14 = Class #16 // Direction + #15 = NameAndType #17:#18 // TOP:LDirection; + #16 = Utf8 Direction + #17 = Utf8 TOP + #18 = Utf8 LDirection; + #19 = Methodref #20.#21 // Sample.ifStatement:(LDirection;)I + #20 = Class #22 // Sample + #21 = NameAndType #23:#24 // ifStatement:(LDirection;)I + #22 = Utf8 Sample + #23 = Utf8 ifStatement + #24 = Utf8 (LDirection;)I + #25 = Methodref #26.#27 // java/io/PrintStream.println:(I)V + #26 = Class #28 // java/io/PrintStream + #27 = NameAndType #29:#30 // println:(I)V + #28 = Utf8 java/io/PrintStream + #29 = Utf8 println + #30 = Utf8 (I)V + #31 = Fieldref #14.#32 // Direction.BOTTOM:LDirection; + #32 = NameAndType #33:#18 // BOTTOM:LDirection; + #33 = Utf8 BOTTOM + #34 = Fieldref #14.#35 // Direction.LEFT:LDirection; + #35 = NameAndType #36:#18 // LEFT:LDirection; + #36 = Utf8 LEFT + #37 = Fieldref #14.#38 // Direction.RIGHT:LDirection; + #38 = NameAndType #39:#18 // RIGHT:LDirection; + #39 = Utf8 RIGHT + #40 = Fieldref #41.#42 // Sample$1.$SwitchMap$Direction:[I + #41 = Class #43 // Sample$1 + #42 = NameAndType #44:#45 // $SwitchMap$Direction:[I + #43 = Utf8 Sample$1 + #44 = Utf8 $SwitchMap$Direction + #45 = Utf8 [I + #46 = Methodref #14.#47 // Direction.ordinal:()I + #47 = NameAndType #48:#49 // ordinal:()I + #48 = Utf8 ordinal + #49 = Utf8 ()I + #50 = Class #51 // java/lang/IncompatibleClassChangeError + #51 = Utf8 java/lang/IncompatibleClassChangeError + #52 = Methodref #50.#3 // java/lang/IncompatibleClassChangeError."":()V + #53 = Utf8 Code + #54 = Utf8 LineNumberTable + #55 = Utf8 main + #56 = Utf8 ([Ljava/lang/String;)V + #57 = Utf8 StackMapTable + #58 = Utf8 switchStatement + #59 = Utf8 SourceFile + #60 = Utf8 Sample.java + #61 = Utf8 NestMembers + #62 = Utf8 InnerClasses +{ + public Sample(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + 0: aload_0 + 1: invokespecial #1 // Method java/lang/Object."":()V + 4: return + LineNumberTable: + line 1: 0 + + public static void main(java.lang.String...); + descriptor: ([Ljava/lang/String;)V + flags: (0x0089) ACC_PUBLIC, ACC_STATIC, ACC_VARARGS + Code: + stack=2, locals=1, args_size=1 + 0: getstatic #7 // Field java/lang/System.out:Ljava/io/PrintStream; + 3: getstatic #13 // Field Direction.TOP:LDirection; + 6: invokestatic #19 // Method ifStatement:(LDirection;)I + 9: invokevirtual #25 // Method java/io/PrintStream.println:(I)V + 12: getstatic #7 // Field java/lang/System.out:Ljava/io/PrintStream; + 15: getstatic #31 // Field Direction.BOTTOM:LDirection; + 18: invokestatic #19 // Method ifStatement:(LDirection;)I + 21: invokevirtual #25 // Method java/io/PrintStream.println:(I)V + 24: getstatic #7 // Field java/lang/System.out:Ljava/io/PrintStream; + 27: getstatic #34 // Field Direction.LEFT:LDirection; + 30: invokestatic #19 // Method ifStatement:(LDirection;)I + 33: invokevirtual #25 // Method java/io/PrintStream.println:(I)V + 36: getstatic #7 // Field java/lang/System.out:Ljava/io/PrintStream; + 39: getstatic #37 // Field Direction.RIGHT:LDirection; + 42: invokestatic #19 // Method ifStatement:(LDirection;)I + 45: invokevirtual #25 // Method java/io/PrintStream.println:(I)V + 48: return + LineNumberTable: + line 4: 0 + line 5: 12 + line 6: 24 + line 7: 36 + line 8: 48 + + public static int ifStatement(Direction); + descriptor: (LDirection;)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + 0: aload_0 + 1: getstatic #13 // Field Direction.TOP:LDirection; + 4: if_acmpne 9 + 7: iconst_1 + 8: ireturn + 9: aload_0 + 10: getstatic #31 // Field Direction.BOTTOM:LDirection; + 13: if_acmpne 18 + 16: iconst_2 + 17: ireturn + 18: aload_0 + 19: getstatic #34 // Field Direction.LEFT:LDirection; + 22: if_acmpne 27 + 25: iconst_3 + 26: ireturn + 27: aload_0 + 28: getstatic #37 // Field Direction.RIGHT:LDirection; + 31: if_acmpne 36 + 34: iconst_4 + 35: ireturn + 36: iconst_0 + 37: ireturn + LineNumberTable: + line 11: 0 + line 12: 7 + line 14: 9 + line 15: 16 + line 17: 18 + line 18: 25 + line 20: 27 + line 21: 34 + line 23: 36 + StackMapTable: number_of_entries = 4 + frame_type = 9 /* same */ + frame_type = 8 /* same */ + frame_type = 8 /* same */ + frame_type = 8 /* same */ + + public static int switchStatement(Direction); + descriptor: (LDirection;)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + 0: getstatic #40 // Field Sample$1.$SwitchMap$Direction:[I + 3: aload_0 + 4: invokevirtual #46 // Method Direction.ordinal:()I + 7: iaload + 8: tableswitch { // 1 to 4 + 1: 48 + 2: 52 + 3: 56 + 4: 60 + default: 40 + } + 40: new #50 // class java/lang/IncompatibleClassChangeError + 43: dup + 44: invokespecial #52 // Method java/lang/IncompatibleClassChangeError."":()V + 47: athrow + 48: iconst_1 + 49: goto 61 + 52: iconst_2 + 53: goto 61 + 56: iconst_3 + 57: goto 61 + 60: iconst_4 + 61: ireturn + LineNumberTable: + line 27: 0 + line 28: 48 + line 29: 52 + line 30: 56 + line 31: 60 + line 27: 61 + StackMapTable: number_of_entries = 6 + frame_type = 40 /* same */ + frame_type = 7 /* same */ + frame_type = 3 /* same */ + frame_type = 3 /* same */ + frame_type = 3 /* same */ + frame_type = 64 /* same_locals_1_stack_item */ + stack = [ int ] +} +SourceFile: "Sample.java" +NestMembers: + Sample$1 +InnerClasses: + static #41; // class Sample$1 diff --git a/jaehong/chapter5/class b/jaehong/chapter5/class new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/for b/jaehong/chapter5/for new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/from b/jaehong/chapter5/from new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/ifStatement(Direction); b/jaehong/chapter5/ifStatement(Direction); new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/int b/jaehong/chapter5/int new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/javap b/jaehong/chapter5/javap new file mode 100644 index 0000000..7467582 Binary files /dev/null and b/jaehong/chapter5/javap differ diff --git a/jaehong/chapter5/list b/jaehong/chapter5/list new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/main(java.lang.String...); b/jaehong/chapter5/main(java.lang.String...); new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/of b/jaehong/chapter5/of new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/options b/jaehong/chapter5/options new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/possible b/jaehong/chapter5/possible new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/public b/jaehong/chapter5/public new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/static b/jaehong/chapter5/static new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/switchStatement(Direction); b/jaehong/chapter5/switchStatement(Direction); new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/untitled/build.gradle b/jaehong/chapter5/untitled/build.gradle new file mode 100644 index 0000000..3cae2d7 --- /dev/null +++ b/jaehong/chapter5/untitled/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java' +} + +group 'org.example' +version '1.0-SNAPSHOT' + +repositories { + mavenCentral() +} + +dependencies { + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' +} + +test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/jaehong/chapter5/untitled/gradle/wrapper/gradle-wrapper.jar b/jaehong/chapter5/untitled/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..249e583 Binary files /dev/null and b/jaehong/chapter5/untitled/gradle/wrapper/gradle-wrapper.jar differ diff --git a/jaehong/chapter5/untitled/gradle/wrapper/gradle-wrapper.properties b/jaehong/chapter5/untitled/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ae04661 --- /dev/null +++ b/jaehong/chapter5/untitled/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/jaehong/chapter5/untitled/gradlew b/jaehong/chapter5/untitled/gradlew new file mode 100755 index 0000000..a69d9cb --- /dev/null +++ b/jaehong/chapter5/untitled/gradlew @@ -0,0 +1,240 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/jaehong/chapter5/untitled/gradlew.bat b/jaehong/chapter5/untitled/gradlew.bat new file mode 100644 index 0000000..f127cfd --- /dev/null +++ b/jaehong/chapter5/untitled/gradlew.bat @@ -0,0 +1,91 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/jaehong/chapter5/untitled/settings.gradle b/jaehong/chapter5/untitled/settings.gradle new file mode 100644 index 0000000..cc6146c --- /dev/null +++ b/jaehong/chapter5/untitled/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = 'untitled' + diff --git a/jaehong/chapter5/untitled/src/main/java/org/example/Main.java b/jaehong/chapter5/untitled/src/main/java/org/example/Main.java new file mode 100644 index 0000000..0f872c1 --- /dev/null +++ b/jaehong/chapter5/untitled/src/main/java/org/example/Main.java @@ -0,0 +1,11 @@ +package org.example; + +public class Main { + public static void main(String[] args) { + Integer number1 = 1; + int number2 = 1; + + Long long1 = 1L; + long long2 = 1L; + } +} \ No newline at end of file diff --git a/jaehong/chapter5/untitled/src/main/java/org/example/MyInteger.java b/jaehong/chapter5/untitled/src/main/java/org/example/MyInteger.java new file mode 100644 index 0000000..dcd87a4 --- /dev/null +++ b/jaehong/chapter5/untitled/src/main/java/org/example/MyInteger.java @@ -0,0 +1,25 @@ +package org.example; + +public class MyInteger { + private int value; + + public MyInteger(int value) { + this.value = value; + } + + public int intValue() { + return value; + } + + public static MyInteger valueOf(int value) { + return new MyInteger(value); + } + + public static MyInteger valueOf(Integer value) { + return new MyInteger(value.intValue()); + } + + public static int unbox(MyInteger myInteger) { + return myInteger.intValue(); + } +} \ No newline at end of file diff --git a/jaehong/chapter5/untitled/src/main/java/org/example/Sample.java b/jaehong/chapter5/untitled/src/main/java/org/example/Sample.java new file mode 100644 index 0000000..d383fb6 --- /dev/null +++ b/jaehong/chapter5/untitled/src/main/java/org/example/Sample.java @@ -0,0 +1,14 @@ +package org.example; + +public class Sample{ + + public static void main(String...args){ + Integer number1 = 1; + int number2 = 1; + + Long long1 = 1L; + long long2 = 1L; + + + } +} diff --git a/jaehong/chapter5/use b/jaehong/chapter5/use new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/void b/jaehong/chapter5/void new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/{ b/jaehong/chapter5/{ new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter5/} b/jaehong/chapter5/} new file mode 100644 index 0000000..e69de29 diff --git a/jaehong/chapter6/.Test.java.swp b/jaehong/chapter6/.Test.java.swp new file mode 100644 index 0000000..c429b0e Binary files /dev/null and b/jaehong/chapter6/.Test.java.swp differ diff --git a/jaehong/chapter6/ControlIf.class b/jaehong/chapter6/ControlIf.class new file mode 100644 index 0000000..6043cb3 Binary files /dev/null and b/jaehong/chapter6/ControlIf.class differ diff --git a/jaehong/chapter6/ControlIf.java b/jaehong/chapter6/ControlIf.java new file mode 100644 index 0000000..52dfe1f --- /dev/null +++ b/jaehong/chapter6/ControlIf.java @@ -0,0 +1,19 @@ +public class ControlIf{ + + public static void main(String...args){ + + var control = new ControlIf(); + } + + public void ifStatement(){ + if(true); + if(true); + if(true); + if(true); + if(true); + if(true); + if(true); + if(true); + if(true) System.out.println("It's true"); + } +} diff --git a/jaehong/chapter6/Sample.c b/jaehong/chapter6/Sample.c new file mode 100644 index 0000000..e216155 --- /dev/null +++ b/jaehong/chapter6/Sample.c @@ -0,0 +1,19 @@ +#include + +int main(){ + + if(1){ + printf("1 run \n"); + } + if(3){ + printf("3 run \n"); + } + if(-1){ + printf("-1 run \n"); + } + + if(0){ + printf("0 run \n"); + } + return 0; +} diff --git a/jaehong/chapter6/Sample.go b/jaehong/chapter6/Sample.go new file mode 100644 index 0000000..5bc9898 --- /dev/null +++ b/jaehong/chapter6/Sample.go @@ -0,0 +1,9 @@ +package main + +import "fmt" + +func main(){ + + fmt.println("hello world") + +} diff --git a/jaehong/chapter6/Sample.java b/jaehong/chapter6/Sample.java new file mode 100644 index 0000000..fb83aed --- /dev/null +++ b/jaehong/chapter6/Sample.java @@ -0,0 +1,9 @@ +public class Sample{ + + + public static void main(String...args){ + if(3){ + System.out.println("run"); + } + } +} diff --git a/jaehong/chapter6/Sample.js b/jaehong/chapter6/Sample.js new file mode 100644 index 0000000..bcd2e08 --- /dev/null +++ b/jaehong/chapter6/Sample.js @@ -0,0 +1,13 @@ +if(3){ + console.log("3 run"); +} + +if(0){ + + console.log("0 run"); +} + +if(-1){ + + console.log("-1 run"); +} diff --git a/jaehong/chapter6/a.out b/jaehong/chapter6/a.out new file mode 100755 index 0000000..80961f9 Binary files /dev/null and b/jaehong/chapter6/a.out differ diff --git a/jaehong/marp/Main.class b/jaehong/marp/Main.class new file mode 100644 index 0000000..7838318 Binary files /dev/null and b/jaehong/marp/Main.class differ diff --git a/jaehong/marp/Main.java b/jaehong/marp/Main.java new file mode 100644 index 0000000..2ed05f6 --- /dev/null +++ b/jaehong/marp/Main.java @@ -0,0 +1,7 @@ + +public class Main{ + public static void main(String ...args){ + System.out.println("Hello world"); + new Sample(); + } +} diff --git a/jaehong/marp/README.md b/jaehong/marp/README.md new file mode 100644 index 0000000..cc6d435 --- /dev/null +++ b/jaehong/marp/README.md @@ -0,0 +1,24 @@ +--- +marp: true +theme: gaia + +--- + +# 토비의 스프링을 학습하고 무엇을 얻었는가 + +--- + +# 목차 + +- 필사를 통해서 배운것 +- 스프링의 역사 +- 이번 스터디를 진행하면서 배운 것 들 +--- + +# 필사를 통해서 배운것 + +## 필사는 **책을 손으로 직접 베껴 쓰는 일** 입니다. +![img.png](img.png) + +--- + diff --git a/jaehong/marp/Sample.class b/jaehong/marp/Sample.class new file mode 100644 index 0000000..6211b36 Binary files /dev/null and b/jaehong/marp/Sample.class differ diff --git a/jaehong/marp/Sample.java b/jaehong/marp/Sample.java new file mode 100644 index 0000000..3d028fe --- /dev/null +++ b/jaehong/marp/Sample.java @@ -0,0 +1,8 @@ + +public class Sample{ + private final String id; + + public Sample(){ + id = "id"; + } +} diff --git a/jaehong/marp/img.png b/jaehong/marp/img.png new file mode 100644 index 0000000..96bb01d Binary files /dev/null and b/jaehong/marp/img.png differ