Development/Java(853)
-
Serializable 경고 표시되지 않게 하기 – Warning: The serializable class UserException does not declare a static final serialVersionUID field of type long
Serializable 경고 표시하지 않게 하기 경고 메시지 The serializable class UserException does not declare a static final serialVersionUID field of type long 설정 변경 전 eclipse: WIndows >> Perferences 왼쪽 창에서 Java >> Compiler >> Errors/Warnings 클릭 >> 오른쪽 창에서 Potential Programming problems항목 확장하면 하단에 Serializable class without serialVersionUID:항목이 보입니다. Serializable class without serialVersionUID:항목을 Warning -> Ignore로..
-
static 메소드(클래스 메소드)
static· static 예약어· static정의 형식· http://codedragon.tistory.com/2482· static변수(class 변수)· http://codedragon.tistory.com/4606· static 메소드(클래스 메소드) static 메소드(클래스 메소드)· static 메소드의 기본적인 특성과 접근방법은 static 변수와 동일· 인스턴스를 생성하지 않아도 static 메소드는 호출 가능 public class StaticCount { public static void showNumber(int number) { System.out.println(number); } public static int add(int num1, int num2) { return num1 ..
-
All that 사과(Apple)
All that APPLE Baruch de Spinoza Sir Isaac Newton Alan Turing Forbidden fruit Schneewittchen Apple images.google.com
-
OverloadingEx04-생성자 오버로딩
생성자 오버로딩 인자값을 가진 생성자를 통해 다양한 인스턴스 생성 출력결과 소스코드 public class OverloadingEx04 { public static void main(String[] args) { //3개 인자값을 가진 생성자를 통해 인스턴스 생성 Person man=new Person("일지매", 880102, 32); //2개 인자값을 가진 생성자를 통해 인스턴스 생성 Person idol=new Person("홍길동", 18); man.showInfo(); idol.showInfo(); } } class Person{ private String personName; private int personID; private int personAge; //생성자 오버로딩 public Per..
-
ConsoleOutputEx05-서식문자 확인
서식문자 확인 System.out.printf vs System.out.println 차이 확인 System.out.printf vs System.out.println System.out.println출력후 다음행으로 이동System.out.printf출력후 다음행으로 이동 안함, 서식문자 사용 출력형태 소스코드 public class ConsoleOutputEx05 { public static void main(String[] args){ System.out.printf("%c", 'A'); System.out.println(""); //A System.out.printf("%7c", 'A'); System.out.println(""); //[ A] System.out.printf("%-7c", 'A'..
-
ConsoleInputEx04-next() vs nextLine()
Scanner클래스의 메소드 사용하여 입력시 next() 와 nextLine() 함수의 차이 next() vs nextLine() next()문자 또는 문자열을 공백을 기준으로 한단어 또는 한문자를 입력 받습니다.nextLine()문자 또는 문자열 한라인 전체를 입력 받습니다. 출력 결과 s = scanner.nextLine(); s = scanner.next(); 소스코드 import java.util.Scanner; public class ConsoleInputEx04 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String s; //nextLine(): 문자 또는 문자열 한라인 전체를 입력 받..