231215 JAVA Test01

2023. 12. 15. 19:592023.11.21-2024.05.31

package test

class Test01

package test;

 

import com.poseidon.constructor.Human;

 

public class Test01 {

public static void main(String[] args) {

 

Human h1 = new Human("홍길동",150);

System.out.println(h1.getName());

 

h1.setMoney(5000);

System.out.println(h1.getMoney());

//get은 return set은 void

 

h1.setAddr("은평구");

String addr = h1.getAddr();

System.out.println(addr);

}

 

}

 

 

package test

class Test02

package test;

 

public class Test02 {

public static void main(String[] args) {

String str1 = "Programming";

String str2 = "Programming";

String str3 = new String("Programming");

System.out.println(str1 == str2);

System.out.println(str1 == str3);

System.out.println(str1.equals(str3));//내부의 값(문장)이 같냐

System.out.println(str2.equals(str3));

 

}

}

 

package test

class Test03

package test;

/*

* */

public class Test03 {

public static void main(String[] args) {

//^| &

System.out.println(2&7);//2 = 양쪽 다 참이어야 1

System.out.println(2|7);//7 = 한쪽이 참이면 다 1

System.out.println(2^7);//5 = 참이면 0, 어느 한 쪽에 있어도 1, 0은 0

//2 0010

//7 0111

//==========

// 0

 

 

 

}

 

}

'2023.11.21-2024.05.31' 카테고리의 다른 글

231218 JAVA Access Modigiers(접근제어자)  (0) 2023.12.19
231218 JAVA jinMaker  (0) 2023.12.19
231215 JAVA Human  (0) 2023.12.15
231215 JAVA Constructor01(생성자)  (0) 2023.12.15
231214 JAVA Apple  (0) 2023.12.15