본문 바로가기
공부

runnable 인터페이스 예시

by 하프상 2017. 6. 1.

package java_programming;


public class runnabletest implements Runnable {


public static void main(String[] args) {

// TODO Auto-generated method stub

runnabletest sm = new runnabletest();

sm.run();


}


@Override

public void run() {

// TODO Auto-generated method stub

int count = 0;

for(int i=1; i<101; i++)

{

if(i%2 == 0)

{

System.out.print(i + " ");

count++;

if(count == 21)

{

System.out.println("\n");

count = 0;

}

}

}

}


}



'공부' 카테고리의 다른 글

(오일러 7번) 10001번째의 소수  (0) 2017.09.06
HashMap 을 이용한 정보 출력  (0) 2017.06.01
git  (0) 2017.05.17
원의 넓이(다른 클래스의 변수 참조)  (0) 2017.04.08
두 수의 크기 비교(오버로딩)  (0) 2017.04.08

댓글