ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 2023년 05월09일 수업 내용 정리
    국비 교육 내용 정리 2023. 5. 9. 08:55

    * 자바 기초 설치 방법  

    https://www.eclipse.org/downloads/packages/

     

    Eclipse Downloads | The Eclipse Foundation

    The Eclipse Foundation - home to a global community, the Eclipse IDE, Jakarta EE and over 415 open source projects, including runtimes, tools and frameworks.

    www.eclipse.org

    <초기 이클립스 다운로드>

    -> Eclipse IDE for Enterprise Java and Web Developers >> 다운로드

    -> c드라이브에 폴더 만들어주고 실행

    ->

    -> 오른쪽 아이콘 자바 클릭 -> create java project 생성 

     

    -> 모듈 체크 해제->  next 클릭 -> src 파일이 생길거임 확인 -> finish!

    -> 맨위 windows -> preferences  -> encodig 검색 -> general -> workspace -> 맨아래 other이 UTF-8 되어있어야함(제일 무난함) -> JSP Files -> encoding utf8로 설정~

     

    -> 왼쪽 src 우클릭 new package ->  name 설정~ -> package 만들어짐~ 

    -> ctrl+N 였나? (까먹음 .. ㅋㅋ 알아봐야됨).누르면 똑같은  패키지 만들수 있음 예를들어 ch01 우클릭후 똑같은 패키지 만들건데 

    그 밑에 ex01을 만들고 싶다 하믄 ch1.ex01 하믄 됨

    -> 밑에 create java ~~ 체크 해제! 

    ch01일쪽 오른쪽 클릭 new -> name 적어주고 (class는 대문자로 시작 Hello)

    -> 완료하기

    -> main 치고 ctrl + space 하믄 자동완성 기능 됨!!!!! (web 개발 넘어가면 필요없다함.)

     

    -> C:\DEV\Workspace\java01_basic\bin\ch01 -> 기존 이클립스에서 작성한거를 저장하믄 저장된 파일이 생성이됨.

     

     

    <eclips>

    package ch01.ex01; // 프로그램 내에 공간을 분리하는 역할

     

    public class Hello { //자바에서 실행되는 최소 단위

     

    public static void main(String[] args) { //프로그램을 구동하기 위한 메서드

    => main 이라 치고 ctrl + space

               System.out.println("hello");  // 헬로우 출력 

    => syso + ctrl +space

    }

    }

    //Hello.java(소스코드 작성) -> 저장(compile) -> Hello.class(바이트코드)-> 실행(run)

    //저장(ctrl+s), 실행(ctrl+F11)

     

    /*

    Q1,아래 내용을 수행하세요.

    -ch01.ex01 패키지 아래에

    -Quiz01.java 클래스를 만들고

    -Quiz01 class "출력" 이라는 메세지를 콘솔창에 출력 하세요.

    */

     

    --------------------------------------------------------------------------------------------------------

    * class 설정 방법

     

    => 밑에 public static void main , inherited abstract medhods 클릭 

     

    *  java 기본 (저장 후에 run(ctrl+f11) 하자!)

    package ch01.ex02;

     

    public class C02Variable {

    public static void main(String[] args) {

     

    int num;//변수 선언: [데이터타입][변수명]

    num = 1;// 값을 저장(변수 초기화)

    System.out.println(num);//1

     

    // int num2;// 같은 메소드 내에서 동일한 이름의 변수명 선언 X

     

    num = 0; // 재할당

    System.out.println(num);// 0

     

    int num2 = 2; // 변수 선언과 동시에 초기화

    System.out.println(num2);

     

    int a,b;

    a = 1;

    b = 2;

     

    int c=3,d=4;

     

    }

     

    }

     

    *  java 변수

    (저장 후에 run(ctrl+f11) 하자!)

     

    package ch01.ex02;

     

    public class C02 {

     

     

    public static void main(String[] args) {

     

    int salary;

    int basicPay = 6000;

    int bonus= 1000;

     

    salary = basicPay + bonus;

     

    System.out.println(salary);

    }

     

    }

    *  java 산술 연산

    (저장 후에 run(ctrl+f11) 하자!)

    (1)

    package ch02.ex01;

     

    public class C01Arithmetic {

     

    public static void main(String[] args) {

    // 산술 연산자: +,-,*,/,%

    int a = 10;

    int b = 3;

    System.out.println(a+b); //13

    System.out.println(a-b); //7

    System.out.println(a*b); //30

    System.out.println(a/b); //3 int/int->int(산술연산자!)

    System.out.println(a%b); //1

     

    }

     

    }

     

    (2)

    package ch02.ex01;

     

    public class C02assignment {

     

    public static void main(String[] args) {

    // 대입 연산자(=)

    // 오른쪽에 있는 식(expression)/값을 왼쪽의 변수에 저장

    int a=1,b=2;

     

    a = b; // b를 a에 저장한다는뜻 같다는 뜻 아님!

    System.out.println(a);

     

    a = a + 1;

    System.out.println(a);//3

     

    // 복합 대입 연산자

    int i = 3;

     

    i = i + 2; //5

    i += 2; //7 i = i + 2

    i -=2; // 5 i = i - 2

    i *=2; // 10 i = i * 2

    i /=2; // 5 i = i / 2

    i %=2; // 1 i = i % 2

    System.out.println(i);

    }

    <html,css> 

    *float 

    ex: right 하면 오른쪽 으로 박스가 가고 텍스트는 박스 주위에 글자 입력이 된다~

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <style>
            .parent{
                border: 5px solid red;
                width: 600px;
                /* height: 200px; :부모한테 높이를 안줘도 자식이 높이를 줬으므로 높이값 고정됨.*/
                margin: auto;
                /* overflow: hidden; : 자식이 float이고 부모가 overflow: hidden 이면 정상적으로 돌아옴*/
            }
            .child1{
                width: 200px;
                height: 200px;
                background-color:gold;
                /* margin: auto; */
                float: left;
            }
        </style>
    </head>
    <body>
        <div class="parent">
            <div class="child1"></div>
        </div>
    </body>
    </html>

     

     

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <style>
            div{
                border: 2px solid gold;
                width: 100px;
                height: 100px;
                border-radius: 10px;
            }
            .box1{
                background-color: gold;
                float: left;
            }
            .box2{
                background-color: skyblue;
                float: left;
            }
            .box3{
                background-color: crimson;
                float: left;
            }
            .box4{
                background-color: yellowgreen;
                float: right;
            }
        </style>
    </head>
    <body>
        <div class="box1"></div>
        <div class="box2"></div>
        <div class="box3"></div>
        <div class="box4"></div>
    </body>
    </html>

    =http://127.0.0.1:5500/CSS/ch07_float/test03.html

     

     

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <style>
            div {
                border: 2px solid gold;
                border-radius: 10px;
            }
            .box1{
                background-color: yellow;
                float: left;
            }
            .box2{
                /* width: 100px;
                height: 100px; */
                /* float:left; */
                background-color: crimson;
            }
            .box3{
                background-color: dodgerblue;
                clear: both;
            }
        </style>
    </head>
    <body>
        <div class="box1">div1</div>
        <span class="box2">span1</span>
        <div class="box3">div2</div>
    </body>
    </html>

     

     

    <과제 코드: 구글링~!>

     

     

     

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <style>
           body{
            font-family: 'Raleway', sans-serif;
            font-weight: 300;
            color: #222;
            width: 80px;
            height: 100vh;

           }
           .box-border{
            width:750px;
            padding: 25px;
            background-color: #f5f5f5;
            display: flex;
            justify-content: center;
            align-items: center;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
           
           }
           .box2-border{
            display: inline-block;
            width: 700px;
           }
           .checkbox-style{
            margin-top: 10px;
            margin-bottom: 10px;
           }
           .input-style{
            padding: 20px;
            width: 650px;
            border-radius: 20;
            border: 1px solid #ddd;
           }
           .input-style:hover{
             border: 1px solid dodgerblue;
             box-shadow: dodgerblue;
           }    
           .button-style{
            color: white;
            background-color: #2991b1;
            padding: 10px;
            font-size: 24px;
            width: 300px;
            box-shadow: 0 0 25px;
           }
           .passowrd-position{
             float: right;
           }
           .password-style{
            text-decoration: none;
            color: black;
           }
           .box3-border{
            margin-bottom: 20px;
            margin-top:10px;

           }
           .box4-border{
            margin-bottom: 20px;
            margin-top: 10px;
           }
       
        </style>
    </head>
    <body>
        <div class="box-border">
         <div>
             <div class="box2-border">
            <div>
                <span><strong>Email</strong></span>
                <div class="box3-border">
                <input type="text" class="input-style" placeholder="Email Address">
                </div>
             <span><strong>Password</strong></span>
                <div class="box4-border">
             <input type="text" class="input-style" placeholder="Password">
                </div>
            </div>
            <div class="checkbox-style">
            <label><input type="checkbox" value="keep me Loggedin"> keep me Logged in</label>
            <span class="passowrd-position"><a href="#" class="password-style">For got your password?</a></span>
             </div>
            <div>
            <span><button class="button-style">Log in</button></span>
            </div>
        </div>
        </div>
        </div>
    </body>
    </html>

     

     

     

     

     

     

     

     

     

     

     

Designed by Tistory.