<Git>OperatorEx.java
·
console.log("What ? " + Cord);/Java
package ch01_variable_operator; public class OperatorEx { public static void main(String[] args) { int a = 3 - -2, b = 3 ; int x = (a >= b) ? 5 : (a+2); x += ++a ; int y = ++a ; y += a + --b ; char ch3 = 'D' ; int z = ch3 >= 'A' && ch3 y ? z - y : x + z ; System.out.println("result : " + result); } }
<Git>Operator01.java
·
console.log("What ? " + Cord);/Java
package ch01_variable_operator; public class Operator01 { public static void main(String[] args) { int a = 10 , b = 8 ; boolean bool1 = a!=b ; boolean bool2 = --a == b++ ; // a = 9 , b = 9 boolean bool3 = a++ != --b ; // a = 10 , b = 8 boolean bool4 = bool3 && (5>7) ; boolean bool5 = !bool4 || (bool1 && bool2) ; System.out.println("bool1 : " + bool1); System.out.println("bool2 : " + bool2); Syst..
<Git> Increment01.java
·
console.log("What ? " + Cord);/Java
package ch01_variable_operator; public class Increment01 { public static void main(String[] args) { // = 기호는 대입(assign) 연산자입니다. int x = 5 ; // 변수 x를 정의한 다음, 5를 대입(writer)합니다. //x = x + 3 ; // 누적 x += 3 ; // 누적 System.out.println("x : " + x); x *= 4 ; System.out.println("x : " + x); x %= 5 ; System.out.println("x : " + x); x -= 1 ; System.out.println("x : " + x); x += 7 ; System.out.println("x : ..
<Git>MyPrint.java
·
console.log("What ? " + Cord);/Java
package ch01_variable_operator; // 주석(comment) : 프로그램의 이해를 돕기 위하여 작성하는 작은 문구 // 한 줄 주석은 슬래시 2개로 작성한다. /* 목적 : 자바 1번째 프로그래밍 작성 일자 : 2022/12/29 작성자 : 홍길동 여기는 multiline 주석 영역 */ public class MyPrint { // 클래스 바디(body) // 함수=동작=역할=메소드 // main 메소드 : 프로그램 최초 시작(entry point) 하는 지점 public static void main(String[] args) { // 메소드 바디(body) // 문자열은 0개 이상의 글자의 집합 // 반드시 쌍따옴표로 포함 하여야 한다. // cf) 문자는 글자 1개를 의미하..
<Git>MyBox.java
·
console.log("What ? " + Cord);/Java
package ch01_variable_operator; public class MyBox { public static void main(String[] args) { double width ; double height ; double area ; double perimeter ; width = 10.0 ; height = 5.0 ; area = width * height ; perimeter = 2 * (width+height) ; System.out.println("사각형 넓이 :" +area); System.out.println("사각형 둘레 :" +perimeter); } }
<Git>LogicalOperator.java
·
console.log("What ? " + Cord);/Java
package ch01_variable_operator; public class LogicalOperator { public static void main(String[] args) { // hard coding System.out.println(3 >= 2); System.out.println(!(3 >= 2)); System.out.println(3 == 2); System.out.println(3 != 2); System.out.println(3.45 2) && (3>4)); int x = 3, y = 2 ; System.out.println((x != y) || (-1 > 0)); // 문자는 정수 값으로 변환되어 연산이 됩니다. System.out.println('a' > 'b'); } }
<Git> ErrorDebug.java
·
console.log("What ? " + Cord);/Java
package ch01_variable_operator; public class ErrorDebug { public static void main(String[] args) { int a,b,c ; a = 21 ; b = 7 ; c = a+b ; System.out.println("a+b = " +c); c = a-b ; System.out.println("a-b =" + c); c = a/b; System.out.println("a/b =" +c); } } cf) Myjava/ErrorDebug.java at master · nolooker/Myjava (github.com)
<Git> Condition02.java
·
console.log("What ? " + Cord);/Java
package ch01_variable_operator; public class Condition02 { public static void main(String[] args) { int a = 8, b = 7 ; int result = a >= b ? 5 : (a + 2) ; System.out.println("result : " + result); int x = 5 ; result = x%2 == 0 ? x+3 : x*x ; System.out.println("result : " + result); } } cf) Myjava/Condition02.java at master · nolooker/Myjava (github.com)