본문 바로가기
반응형

전체 글63

14일차 AWT 종합. 14일차 awt의 전반적인 테스트 AWT_ReviewTest.class실행. package hb.net.java_20151209; public class AWT_ReviewTest { public static void main(String[] args){ //AWT_Review1처럼 메인없이 내용만 있는 class는 어디서든 호출해서 사용할 수 있다 AWT_Introintro = new AWT_Intro(); intro.setLocation(500,300); //가로 세로 } } AWT_Intro.class회원가입, 로그인 두개의 버튼이 있는 화면. package hb.net.java_20151209; import java.awt.*; import java.awt.event.*; public class .. 2015. 12. 9.
13일차 awt 예제 ExamButton.class package hb.net.java_20151208; public class ExamButton { public static void main (String[] args){ //ExamButtonTest ebt = new ExamButtonTest(); ExamButton2 eb2= new ExamButton2(); } } ExamButton2.class package hb.net.java_20151208; import java.awt.*; import java.awt.event.*; /** ExamButton2 는 프레임을 상속받았기 때문에 f.~~ 이따꾸로 붙일필요가 없는겨**/ public class ExamButton2 extends Frame implements A.. 2015. 12. 9.
12일차 예외처리와 awt 1. throws - 메소드를 정의할 때 throws 예약어를 시그내처에 추가하면 그 메소드를 호출하는 곳에서 예외 처리를 해야 한다. - Function throws SomeException이라는 문장을 생각하면 이해가 쉽다. Function이 SomeException 예외를 던진다는 뜻이므로 Function을 사용하는 곳(호출하는 곳)을 try 블록으로 감싸준다. view sourceprint?01.class Test {02.public static void f() throws ArithmeticException {03.int a = 0;04.a = 10/a;05.}06. 07.public static void main(String[] args) {08.try {09.Test.f(); // 이 함수가.. 2015. 12. 8.
11일차 묵시적 형변환과 다형성 11일차 묵시적 형변환. 형 변환은 예제로 설명 ㄱ ClassTypeCastingTest.class package hb.net.java20151204; import java.util.Vector; public class ClassTypeCastingTest { public static void main(String[] args) { //앞에있는게 기준. /** 묵시적 형 변환 **/ Animal a1 = new Animal(); //Animal 타입으로 생성, Animal 타입으로 참조 Man m1 = new Man(); //Man 타입으로 생성 Man 타입으로 참조. Animal a2 = new Man(); //Man 타입으로 생성해서 Animal 타입으로 참조. //Manm2 = new Animal(.. 2015. 12. 4.
반응형