java7 [정보처리기사] 실기 24년 3회 JAVA 문제 19번 해설 문제 19번. 출력 결과class Main { public static class Collection{ T value; public Collection(T t){ value = t; } public void print(){ new Printer().print(value); } class Printer{ void print(Integer a){ System.out.print("A" + a); } void print(Object a){ System.out.print("B" + a); } void print(Number a){ System.out.print("C" .. 2025. 4. 19. [정보처리기사] 실기 24년 3회 JAVA 문제 11번 해설 문제 11번. 출력 결과public class Main{ public static void main(String[] args){ Base a = new Derivate(); Derivate b = new Derivate(); System.out.print(a.getX() + a.x + b.getX() + b.x); }}class Base{ int x = 3; int getX(){ return x * 2; }}class Derivate extends Base{ int x = 7; int getX(){ return x * 3; }} 더보기더보기[ 답 ]52 [ 풀이 ]System.out.print(a.getX() + a.x + b.getX() + .. 2025. 4. 19. [정보처리기사] 실기 24년 1회 JAVA 문제 16번 해설 문제 16번. 출력결과class classOne { int a, b; public classOne(int a, int b) { this.a = a; this.b = b; } public void print() { System.out.println(a + b); } }class classTwo extends classOne { int po = 3; public classTwo(int i) { super(i, i+1); } public void print() { System.out.println(po*po); }} public class main { public stati.. 2025. 4. 19. [정보처리기사] 실기 23년 2회 JAVA 문제 14번 해설 해당 문제는 JAVA의 문자열 비교 개념을 다루고 있다.==참조 비교 (같은 메모리 주소를 가리키는지 확인)equals()값 비교 (객체의 값이 동일한지 확인) 문제public class Main { 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.. 2025. 4. 19. [정보처리기사] 실기 23년 1회 JAVA 문제 20번 해설 이 문제는 생성자 호출 흐름, this 키워드 등의 개념을 알고 있는지 확인하는 문제이다.먼저 풀어보고, 풀이 확인! class Parent { int x = 100; Parent() { this(500); } Parent(int x) { this.x = x; } int getX() { return x; }}class Child extends Parent { int x = 1000; Child() { this(5000); } Child(int x) { this.x = x; }} public class Main { public static void main(String[] args.. 2025. 4. 19. [Android Studio/안드로이드 스튜디오] 액티비티를 활용한 텍스트, 버튼, 이미지 색상 변경 (Java) XML 이 아니라 액티비티에서 텍스트 및 버튼 색상을 변경하는 경우는 대체로 특정 상황마다 색상을 다르게 쓰고 싶을 때이다. JAVA 코드로 액티비티에서 색상을 변경해보자! 1. 텍스트 색상 변경하기텍스트 색상을 변경하는 건 색상 값을 얼마나 많이 바꿀 거냐에 따라 크게 2가지 방법이 있다. 일단 텍스트 객체를 먼저 가져오자.// 색상을 변경할 텍스트 객체 가져오기TextView textView = findViewById(R.id.textView); 첫 번째. 리소스에서 가져온 색상 값을 여러 번 사용할 경우// 가져온 색상 값을 텍스트 객체에 적용textView.setTextColor(ContextCompat.getColor(this, colorNameValue)); 두 번째. 리소스에서 가져온 색상 .. 2023. 8. 13. 이전 1 2 다음 반응형