글

라벨이 자바인 게시물 표시

Java day01 lesson02

package test; public class oper { public static void main(String[] args) { // TODO Auto-generated method stub int a; int b; int ti; float c; float d; float fi; a=8; b=7; ti= a+b; System.out.println(ti); ti= a-b; System.out.println(ti); ti= a*b; System.out.println(ti); ti= a/b; System.out.println(ti); c=8.8f; d=2.2f; fi= c+d; System.out.println(fi); fi= c-d; System.out.println(fi); fi= c*d; System.out.println(fi); fi= c/d; System.out.println(fi); int e=1; e++; System.out.println(e); int f=1; f+=1; System.out.println(f); int g=1; g--; System.out.println(g); int h=1; h-=1; System.out.println(h); int i=8; int j=5; int ni; ni= i % j; System.out.println(ni); System.out.printf("%b\n",i>j); System.out.printf("%b\n", i<j); System.out.printf("%b\n", i==j); System.out.printf("%b\n", i!=j); ...

출력타입

%d: 10진수(정수형) %f: 실수형 %e: 지수형 %o: 8진수 %x: 16진수 %u: 부호없는 10진수 %g: 실수형 자동출력 %p: 포인터의 주소 %c: 하나의 문자로 출력 %s: 문자열

Java dau01 lesson01/ 자바 초급 1일차

package test; public class hello { public static void main(String[] args) { // TODO Auto-generated method stub int age;//1~100, 1000 int는 상수 age는 변수                  age=8; int nai; nai=age; System.out.println(age); System.out.println(nai); } }