이거 맘대로 되는 세상이 아니구만...

자바 기초 로직을 알아보자...2월1일 수업(3) 본문

java

자바 기초 로직을 알아보자...2월1일 수업(3)

바이홍 2007. 2. 1. 17:22
반응형
class Test{
public static void main(String args[]){
A a=new A(100);
System.out.println(a.i);
B b1=new B("abc");
B b2=new B("def");
System.out.println(b1.str+","+b2.str);
a.me();
String st=a.me2();
System.out.println(st);
}
}
class A{
int i;
A(int i){
this.i=i;
}
void me(){
System.out.println("메서드1");
}
String me2(){
return "메서드2";
}
}

class B{
String str;
B(String str){
this.str=str;
}
}
*/
/*
class Test{
public static void main(String args[]){
A a=new A(10 , 5);
int re1=a.me1();
int re2=a.me2();
int re3=a.me3();
int re4=a.me4();
System.out.println(re1);
System.out.println(re2);
System.out.println(re3);
System.out.println(re4);
}
}
class A{
int i;
int j;
A(int i, int j){
this.i=i;
this.j=j;
}
int me1(){
return i+j;
}
int me2(){
return i-j;
}
int me3(){
return i*j;
}
int me4(){
return i/j;
}
}

*/
/*
class Test{
public static void main(String args[]){
A a1=new A(3.4 , 'b');
A a2=new A("abc");
A a3=new A(4.5 , 'c');
A a4=new A();
System.out.println(a1.d+","+a1.ch+","+a1.str);
System.out.println(a2.d+","+a2.ch+","+a2.str);
System.out.println(a3.d+","+a3.ch+","+a3.str);
System.out.println(a4.d+","+a4.ch+","+a4.str);
}
}
class A{
double d;
char ch;
String str;
A(double d, char ch){
this.d=d;
this.ch=ch;
}
A(String str){
this.str=str;
}
A(){
}
}

*/
/* 생각을 해봅시다....참조형 변수??
class Test{
public static void main(String args[]){
A a=new A(new B());
}
}
class A{
A(B obj){
}
}
class B{
}

*/
//기본형 참조형 변수.......
//기본형== char, double,.......
//참조형== a b c 등등.....

Soket s=new Soket("localhost",555);
InputStream is=s.getInputStream();
BufferedReader br=new BufferedReader(new InputStreamReader(is))



class Soket{
String s;
int i;
Soket(String s, int i){
}
InputStream getInputStream(){
}
}
class BufferedReader{
BufferedReader(InputStreamReader obj){
}
}
class InputStreamReader{
InputStreamReader(InputStream obj1){
}
}
class InputStream{
}
Comments