728x90
728x170
파워 자바 컴팩트 4장 연습문제 해설 power java compact
파워 자바 컴팩트 4장 연습문제 해설 power java compact
1번
import java.util.*;
class Student{
String name; //학생 이름
String rollno; //학번
short age; // 나이
}
public class test1 {
public static void main(String[] ar) {
Student a = new Student();
Scanner POWERSCAN = new Scanner(System.in);
System.out.print("학생의 이름: ");
a.name = POWERSCAN.nextLine();
System.out.print("학생의 학번: ");
a.rollno = POWERSCAN.nextLine();
System.out.print("학생의 나이: ");
a.age = POWERSCAN.nextShort();
System.out.println("이름: " + a.name + "\n학번: " + a.rollno+"\n나이: " + a.age);
}
}
2번
class Dog{
String breed;
int age;
String color;
void barking() {
System.out.println("barking()");
}
void hungry() {
System.out.println("hungry()");
}
void sleeping() {
System.out.println("sleeping()");
}
}
public class test2 {
public static void main(String[] args) {
Dog a = new Dog();
System.out.println("york, 1, orange");
a.barking();
a.hungry();
a.sleeping();
}
}
순자산 8.4억이면 상위 10%.JPG
인터넷에서 유명한 글인 순자산 8.4억이면 상위 10%에 대해 알아보도록 하겠습니다. 이 글을 처음부터 끝까지 읽다 보면 순자산 8.4억이면 상위 10%에 대해 아는데 도움이 될 것입니다. 순자산 8.4
tistorysolution.tistory.com
3번
class aaa{
void print1(int y, int m, int d) {
System.out.println(y + "." + m + "." + d);
}
void print2(String day) {
System.out.println(day);
}
}
public class test3 {
public static void main(String[] ar) {
aaa a = new aaa();
a.print1(2012, 9, 5);
a.print2("July 12, 2012");
}
}
4번
import java.io.*;
class bok{
int real=0;
int bok=0;
static BufferedReader in;
static {
in = new BufferedReader(new InputStreamReader(System.in));
}
void Putreal(int real) {
this.real = real;
}
void Putboksosu(int boksosu) {
this.bok = boksosu;
}
}
public class test4 {
public static void main(String[] ar) throws IOException {
bok a = new bok();
System.out.print("실수부: ");
a.Putreal(Integer.parseInt(bok.in.readLine()));
System.out.print("복소수: ");
a.Putboksosu(Integer.parseInt(bok.in.readLine()));
System.out.print(a.real + "+" + a.bok + "i");
}
}
5번
class Account{
int balance;
void Account() {
balance = 0;
}
void withdraw(int amount) {
System.out.println(amount + "원 출금");
this.balance -= amount;
}
void deposit(int amount) {
System.out.println(amount + "원 저축");
this.balance += amount;
}
}
public class test5 {
public static void main(String[] args) {
Account a = new Account();
System.out.println("새로운 계좌가 만들어졌읍니다.");
a.deposit(50000);
Account b = new Account();
System.out.println("새로운 계좌가 만들어졌읍니다.");
b.deposit(100000);
System.out.println("고객 #1 계좌 잔고=" + a.balance);
System.out.println("고객 #2 계좌 잔고=" + b.balance);
}
}
스포츠카를 못타는 인생은 진짜 불쌍한 인생이다
인터넷에서 유명한 글인 스포츠카를 못타는 인생은 진짜 불쌍한 인생이다에 대해 알아보도록 하겠습니다. 이 글을 처음부터 끝까지 읽다 보면 스포츠카를 못타는 인생은 진짜 불쌍한 인생이다
tistorysolution.tistory.com
728x90
그리드형
'IT > 프로그래밍' 카테고리의 다른 글
C++ ESPRESSO 3장 연습문제 해설 (0) | 2020.12.15 |
---|---|
파워 자바 컴팩트 5장 연습문제 해설 power java compact (0) | 2020.12.14 |
파워 자바 컴팩트 3장 연습문제 해설 power java compact (0) | 2020.12.13 |
누구나 쉽게 즐기는 C언어 콘서트 9장 실습문제 정답 (0) | 2020.12.13 |
누구나 쉽게 즐기는 C언어 콘서트 8장 실습문제 정답 (0) | 2020.12.13 |
댓글