전체 글
-
Java - static메소드 참조개발노하우/Java 2007. 4. 18. 12:58
class Exam_02_Sub{ private String name; private double don; private static float iyul; static{ iyul = 0.05f; } public static void setIyul(float iyul){ Exam_02_Sub test = new Exam_02_Sub("A",1000.0,0.07f); Exam_02_Sub.iyul = iyul; test.disp(); } public Exam_02_Sub(String name, double don, float iyul){ this.name = name; this.don = don; Exam_02_Sub.iyul = iyul; } public void disp(){ System.out.prin..
-
Java - static개발노하우/Java 2007. 4. 18. 12:56
class Exam_02_Sub { private String name; private double don; private static float iyul; public static void setIyul(float iyul){ Exam_02_Sub.iyul = iyul; } public Exam_02_Sub(String name, double don, float iyul) { this.name = name; this.don = don; Exam_02_Sub.iyul = iyul; } public void disp() { System.out.println("name : " +this.name); System.out.println("don : " +this.don); System.out.println("i..
-
Java - this.개발노하우/Java 2007. 4. 18. 12:56
class Exam01_sub{ private int x; private int y; public Exam01_sub() { this.x=100; this.y=200; } public void setXY(int x,int y) { this.x = x; this.y = y; } public void disp() { System.out.println("x=" + this.x); System.out.println("y=" + this.y); } } public class thisp{ public static void main(String[] arg) { Exam01_sub ex = new Exam01_sub(); ex.disp(); ex.setXY(10,20); ex.disp(); } }
-
Java - 생성자개발노하우/Java 2007. 4. 18. 12:55
class privat_sub{ private int x=100; private char y='a'; // public void viewX(){ // System.out.println("x="+x); // } public void x(int x) { this.x = x; } public void y(char y) { this.y = y; } public int x() { return x; } public char y() { return y; } } public class privat { public static void main(String[] ar){ privat_sub pr = new privat_sub();; System.out.println("x="+pr.x()); // pr.viewX(); Sy..
-
Java - BufferedReader개발노하우/Java 2007. 4. 18. 12:54
import java.io.*; class Mem_sub { private BufferedReader in; private String name; private int age; public Mem_sub(){ in=new BufferedReader (new InputStreamReader(System.in)); name=""; age=0; } public void setname() throws IOException{ System.out.print("이름="); name=in.readLine(); } public void setage()throws IOException{ System.out.print("나이="); age=Integer.parseInt(in.readLine()); } public void ..