[JAVA]자바란 무엇일까?
·
console.log("What ? " + Cord);/Java
자바의 특징 ◆ 자바는 객체지향 언어이다. - 객체지향 프로그램(OOP, Object Oriented Programming)이란 프로그램을 개발하는 기법으로 부품에 해당하는 객체들을 먼저 만들고, 이것들을 하나씩 조립 및 연결하여 전체 프로그램을 완성하는 것이다. - 객체를 만들기 위해서는 설계도인 클래스를 작성하고, 객체와 객체를 연결하여 목적에 맞는 프로그램을 만들어 낸다. - 객체지향 언어의 특징인 캡슐화, 상속성, 다향성을 완벽하게 지원한다. ◆ 이식성이 높다 - 서로 다른 실행 환경을 가진 시스템 간에 프로그램을 옮겨 실행할 수 있는 것을 말한다. - 자바는 자바 실행환경(JRE)이 설치 되어 있는 모든 운영체제에서 실행이 가능하다. ◆ 인터프린터 언어이다. - 컴파일 언어인 동시에 인터프리터 ..
<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>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> CondOper.java
·
console.log("What ? " + Cord);/Java
package ch01_variable_operator; public class CondOper { public static void main(String[] args) { int x = 3, y = 8, z = 4 ; int max = x > y ? x : y ; max = max > z ? max : z ; System.out.println("최대 : " + max); // 최소 값은 ? int min = x z ? x : z) : (y > z ? y : z) ; System.out.println("최대 : " + max); min = x
<Git> ArithmeticOperator2.java
·
console.log("What ? " + Cord);/Java
package ch01_variable_operator; public class ArithmeticOperator2 { public static void main(String[] args) { int TIME = 8000 ; int hour ; int minute ; int second ; hour = TIME / 3600 ; minute = (TIME - hour * 3600) /60 ; second = TIME % 60 ; System.out.println("시간 : " +TIME); System.out.println("시 : " +hour); System.out.println("분 : " +minute); System.out.println("초 : " +second); System.out.print..
<Git> Arithmetic01.java
·
console.log("What ? " + Cord);/Java
package ch01_variable_operator; public class Arithmetic01 { public static void main(String[] args) { int x = 14 ; int y = 5 ; System.out.println("더하기 : " + (x + y)); System.out.println("빼기 : " + (x - y)); System.out.println("곱하기 : " + (x * y)); System.out.println("나누기 : " + (x / y)); System.out.println("나눗셈 : " + (x % y)); } } cf) Myjava/Arithmetic01.java at master · nolooker/Myjava (github.com)
<Git> add.java
·
console.log("What ? " + Cord);/Java
package ch01_variable_operator; public class Add { public static void main(String[] args) { // 변수 선언(정의) int x ; // 정수형 데이터를 저장하기 위하여 변수 x를 준비해주세요. int y, z ; // 정수가 2개 필요해요. // 값을 대입(할당) assign // =를 대입 연산자라고 부름 x = 3 ; // writer y = 5 ; z = x + y ; // z = 3 + 5 // +의 2가지 역할) (1) 덧셈 (2) 문자열 결합 System.out.println(x + " 더하기 " + y + "는(은) " + z + "입니다." ); x = 4 ; // overwrite y = 9 ; z = x * y ; ..
Java Programming <덧셈 연산>
·
console.log("What ? " + Cord);/Java
임의의 변수를 만들고 계산하는 방법 출력값 = 예시 문제) a,b,c, 결과 값 ; a,b,c 변수를 적용하고 결과 값을 출력해보자! 출력값 =