← Back to feed
🌐Original in Korean. An English translation isn't available yet, so the Korean original is shown.
Renewal·서른의 생활코딩

ex9) java_oop

NS
normalstory
cover image
/*
 //step 01
class BoxT {
private int width; // 변수를 private로 선언하여 외부에서 접근을 막는다
private int height; // 정보의 은폐 제공
private int depth;
private int vol;
public BoxT(int a, int b, int c) { // 클래스의 이름과 같은 이름으로 생성자 선언
width = a; // 초기화 작업 수행
height = b;
depth = c;
}
public int volume() {
vol = width * height * depth;
//private속성이이지만, 같은 class안 이므로 사용가능!
return vol;
}
}
class BoxTestDemo {
public static void main(String args[]) {
int vol;
BoxT mybox1 = new BoxT(10, 20, 30);
//BoxT mybox2 = new BoxT(); //해당 생성자 선언이 없다.!
//System.out.println(mybox1.width); //private속성이라 접근X
vol = mybox1.volume();
System.out.println("mybox1 객체의 부피 : " + vol);
}
}
**/


/*
//step 02
class BoxT {
private int width; // 변수를 private로 선언하여 외부에서 접근을 막는다
private int height; // 정보의 은폐 제공
private int depth;
private int vol;
private BoxT(int a, int b, int c) { // 클래스의 이름과 같은 이름으로 생성자 선언
width = a; // 초기화 작업 수행
height = b;
depth = c;
}
private int volume() {
vol = width * height * depth;
//private속성이이지만, 같은 class안 이므로 사용가능!
return vol;
}
public static BoxT CreateBox(){  // 리턴타입=class
BoxT b =new BoxT(10,20,30);
return b;
}
}
class BoxTestDemo {
public static void main(String args[]) {
int vol;
BoxT.mybox1;
mybox1 = Box.CreateBox();
//BoxT mybox1 = new BoxT(10, 20, 30);
//BoxT mybox2 = new BoxT(); //해당 생성자 선언이 없다.!
//System.out.println(mybox1.width); //private속성이라 접근X
//vol = mybox1.volume();
System.out.println("mybox1 객체의 부피 : " + vol);
}
}
**/


/*
//step 03
class BoxT {
private int width; // 변수를 private로 선언하여 외부에서 접근을 막는다
private int height; // 정보의 은폐 제공
private int depth;
private int vol;
private BoxT(int a, int b, int c) { // 클래스의 이름과 같은 이름으로 생성자 선언
width = a; // 초기화 작업 수행
height = b;
depth = c;
}
private int volume() {
vol = width * height * depth;
//private속성이이지만, 같은 class안 이므로 사용가능!
return vol;
}
public static BoxT CreateBox(){  // 리턴타입=class
BoxT b =new BoxT(10,20,30);
return b;
}
}
class BoxTestDemo {
public static void main(String args[]) {
int vol;
BoxT mybox1;//class명(=자료형 역할!!!!) + 참조 변수명
BoxT.mybox1;
mybox1 = BoxT.CreateBox();
//BoxT mybox1 = new BoxT(10, 20, 30);
//BoxT mybox2 = new BoxT(); //해당 생성자 선언이 없다.!
//System.out.println(mybox1.width); //private속성이라 접근X
//vol = mybox1.volume();
System.out.println("mybox1 객체의 부피 : " + vol);
}
}
**/






class BoxT {
private int width; // 변수를 private로 선언하여 외부에서 접근을 막는다
private int height; // 정보의 은폐 제공
private int depth;
private int vol;
private BoxT(int a, int b, int c) { // 클래스의 이름과 같은 이름으로 생성자 선언
width = a; // 초기화 작업 수행
height = b;
depth = c;
}
int volume() {
vol = width * height * depth;
//private속성이이지만, 같은 class안 이므로 사용가능!
return vol;
}
public static BoxT CreateBox(){  // 리턴타입=class
BoxT b =new BoxT(10,20,30);
return b;
}
}
class BoxTestDemo {
public static void main(String args[]) {
int vol;
BoxT mybox1;
mybox1 = BoxT.CreateBox();
//BoxT mybox1 = new BoxT(10, 20, 30);
//BoxT mybox2 = new BoxT(); //해당 생성자 선언이 없다.!
//System.out.println(mybox1.width); //private속성이라 접근X
vol = mybox1.volume();
System.out.println("mybox1 객체의 부피 : " + vol);
}
}

  • Open in Google Docs Viewer
  • Open link in new tab
  • Open link in new window
  • Open link in new incognito window
  • Download file
  • Copy link address
  • Edit PDF File on PDFescape.com
  • Open in Google Docs Viewer
  • Open link in new tab
  • Open link in new window
  • Open link in new incognito window
  • Download file
  • Copy link address
  • Edit PDF File on PDFescape.com
  • Open in Google Docs Viewer
  • Open link in new tab
  • Open link in new window
  • Open link in new incognito window
  • Download file
  • Copy link address
  • Edit PDF File on PDFescape.com

element

Font
font-family
font-size
font-style
font-variant
font-weight
letter-spacing
line-height
text-decoration
text-align
text-indent
text-transform
white-space
word-spacing
color
Background
bg-attachment
bg-color
bg-image
bg-position
bg-repeat
Box
width
height
border-top
border-right
border-bottom
border-left
margin
padding
max-height
min-height
max-width
min-width
outline-color
outline-style
outline-width
Positioning
position
top
bottom
right
left
float
display
clear
z-index
List
list-style-image
list-style-type
list-style-position
Table
vertical-align
border-collapse
border-spacing
caption-side
empty-cells
table-layout
Effects
text-shadow
-webkit-box-shadow
border-radius
Other
overflow
cursor
visibility

element

Font
font-family
font-size
font-style
font-variant
font-weight
letter-spacing
line-height
text-decoration
text-align
text-indent
text-transform
white-space
word-spacing
color
Background
bg-attachment
bg-color
bg-image
bg-position
bg-repeat
Box
width
height
border-top
border-right
border-bottom
border-left
margin
padding
max-height
min-height
max-width
min-width
outline-color
outline-style
outline-width
Positioning
position
top
bottom
right
left
float
display
clear
z-index
List
list-style-image
list-style-type
list-style-position
Table
vertical-align
border-collapse
border-spacing
caption-side
empty-cells
table-layout
Effects
text-shadow
-webkit-box-shadow
border-radius
Other
overflow
cursor
visibility

element

Font
font-family
font-size
font-style
font-variant
font-weight
letter-spacing
line-height
text-decoration
text-align
text-indent
text-transform
white-space
word-spacing
color
Background
bg-attachment
bg-color
bg-image
bg-position
bg-repeat
Box
width
height
border-top
border-right
border-bottom
border-left
margin
padding
max-height
min-height
max-width
min-width
outline-color
outline-style
outline-width
Positioning
position
top
bottom
right
left
float
display
clear
z-index
List
list-style-image
list-style-type
list-style-position
Table
vertical-align
border-collapse
border-spacing
caption-side
empty-cells
table-layout
Effects
text-shadow
-webkit-box-shadow
border-radius
Other
overflow
cursor
visibility
친절한 찰쓰씨
Written by
친절한 찰쓰씨

Pleasant Charles — UI/UX researcher at AIT. Keeping notes on design, planning, and slow days here since 2010.