728x90

 

package first;

public class BreakExample {

public static void main(String[] args) {

    int dan = 2;
    int times = 1;

    while (dan <= 9) {
        if( ( dan%2 ) != 0) {
            dan++;
            continue;
        }
        times = 1;
        while(times <= 9) {
            System.out.println(dan + "X" + times + "=" + dan*times);
            times++;
        }
        dan++;
        System.out.println();
    }
    
    // while(dan <= 9) {
// times = 1;
// while(times <= 9) {
// if(times > dan) break;
// System.out.println(dan + "X" + times + "=" + dan*times);
// times++;
// }
// dan++;
// System.out.println();
// }

// for(int i = 2 ; i <=9 ; i++) {
// for(int j = 1 ; j <= 9 ; j++) {
// if(j > i) break;
// System.out.println(i + "X" + j + "=" + i*j);
// }
// System.out.println();
// }

}
}

1. 첫번째 코드는 단순 짝수 구구단 출력 

2 ~ 3 번 코드는 2단은 2*2까지  ~ 9단은 9*9까지 값 구하는 구구단

.

728x90

 * 참고 사이트 : jess2.tistory.com/103

728x90

Import java.util.ArrayList;
Import java.util.HashMap;
Import java.util.Iterator;
Import java.util.Map;

Public class foreach{

Public static void main(String[] args){

//1. Map
Map<Object, String> map1 = new HashMap<Object, String>();
    Map1.put("1", "One");
    Map1.put("2", "Two");
    Map1.put("3", "Three");

//2. ArrayList
ArrayList<String> list1 = new ArrayList<String)();
    List1.add("One");
    List2.add("Two");
    List3.add("Three");

//3. HashMap
HashMap<Object, String> map2 = new HashMap<Object, String>();
    Map2.put("1", "One");
    Map2.put("2", "Two");
    Map2.put("3", "Three");


System.out.println("==while문 활용==");

//1
While(it.hasNext()){
    String key = (String)it.next();
    System.out.println(key);
}

//2 
While(it.hasNext()){
    String value = (String)it2.next();
    System.out.println(value);
}

//3
While(it3.hasNext()){
    String value = (String)it3.next();
    System.out.println(value);
}


System.out.println("==for 문 활용==");


//1
For(Object key : map1.keySet()){
    System.out.println("key :" + key + "/value :" + map1.get(key));
}

//2
For(int I = 0 ; list1.size(); i++){
    System.out.println(list1.get(i).toString());
}

//3
For(Object key : map2.keySet()){
    System.out.println("key :" + key + "/value :" + map2.get(key));
}

}
}

728x90

@Override
public List getAgentDisplay(TestVO vo) {
int ttRow = vo.getTtRow();
vo.setTtRow(ttRow);
vo.setRowCount(CommonConstants.DIS_AGENT_ROW_CNT);
List list = dao.selectTest(vo);
List rsVoList = new ArrayList();
for(int i = 0 ; i < 6 ; i++) {
if(i < list.size()) {
TestVO dvo = list.get(i);
rsVoList.add(dvo);
}else {
TestVO dvo = null;
rsVoList.add(dvo);
}
}
return rsVoList;
}

+ Recent posts