Development/Java(855)
-
OverloadingEx01-메서드 오버로딩
메서드 오버로딩 기능이 같은 메서드를 여러개 만들 때 사용함 메서드 명은 같고 인자의 타입을 다르게 명시 타입이 같으면 인자의 갯수를 다르게 명시 갯수가 같으면 순서를 다르게 명시 출력결과 인자의갯수와 자료형이 같은 경우 ERROR 인자명은 같아도 상관없으나 자료형은 달라야 합니다. 소스코드 public class OverloadingEx01 { //멤버메서드 public void getLength(String str){ System.out.println("입력한 값의 길이: " + str.length()); } public void getLength(int n){ //int -> Sting String s = String.valueOf(n); getLength(s); } //ERROR: Duplicat..
-
이클립스에서 인자값을 전달하면서 출력결과 확인하기
이클립스에서 인자값을 전달하면서 출력결과 확인하기 Project Explorer창에서 해당 프로젝트 폴더 선택 > 마우스 우클릭 > Run as > Run Configurations... > Main탭에서 [Search Project]버튼 클릭 현재 수행하고 하는 클래스 선택 > [OK] (x)=Arguments탭 클릭 > Program arguments:영역에 전달할 인자값 입력 후 > [Run]버튼 클릭 출력결과 확인
-
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..