본문 바로가기
학원수업/12월

11/30 국비학원 자바수업 3회차(Visual Studio Code 설정)

by 코딩마스터^^ 2022. 11. 30.

1. git설치
2.VSC 환경설정

r

위의 위치에서 Settings오른마우스 클릭>코드로 열기
VSC 로 엶
슬랙에 코드 그대로 복붙하기

{
  "terminal.integrated.defaultProfile.windows": "Git Bash",
  "terminal.integrated.profiles.windows": {
    "Git Bash": {
      "path": "C:\\Program Files\\Git\\bin\\bash.exe"
    }
  },
  "editor.suggestSelection": "first",
  "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
  "files.exclude": {
    "**/.classpath": true,
    "**/.project": true,
    "**/.settings": true,
    "**/.factorypath": true
  },
  "editor.tabSize": 2,
  "editor.fontSize": 18,
  "editor.fontLigatures": null,
  "workbench.colorTheme": "Default Light+",
  "java.project.importHint": false,
  "redhat.telemetry.enabled": false,
  "editor.formatOnSave": true,
  "editor.fontFamily": "CookieRun, D2Coding, Consolas, 'Courier New', monospace",
  "workbench.startupEditor": "none",
  "explorer.compactFolders": false,
  "workbench.iconTheme": "material-icon-theme",
  "emmet.variables": {
    "lang": "ko"
  },
  "vsicons.dontShowNewVersionMessage": true,
  "liveServer.settings.donotShowInfoMsg": true,
  "liveServer.settings.CustomBrowser": "chrome",
  "html-css-class-completion.enableEmmetSupport": true,
  "editor.tokenColorCustomizations": {
    "comments": "#FFC2C2"
  },
  "[css]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "bracketPairColorizer.depreciation-notice": false,
  "files.autoSave": "afterDelay",
  "workbench.colorCustomizations": {
    "titleBar.activeBackground": "#3F708D",
    "titleBar.inactiveBackground": "#3F708D"
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "js/ts.implicitProjectConfig.strictNullChecks": true,
  "peacock.favoriteColors": [
    {
      "name": "Angular Red",
      "value": "#DD0531"
    },
    {
      "name": "Azure Blue",
      "value": "#007FFF"
    },
    {
      "name": "JavaScript Yellow",
      "value": "#F9E64F"
    },
    {
      "name": "Mandalorian Blue",
      "value": "#1857A4"
    },
    {
      "name": "Node Green",
      "value": "#215732"
    },
    {
      "name": "React Blue",
      "value": "#61DAFB"
    },
    {
      "name": "Something Different",
      "value": "#832561"
    },
    {
      "name": "Svelte Orange",
      "value": "#FF3D00"
    },
    {
      "name": "Vue Green",
      "value": "#42B883"
    }
  ],
  "indentRainbow.colors": [
    "rgba(255,255,64,0.07)",
    "rgba(127,255,127,0.07)",
    "rgba(255,127,255,0.07)",
    "rgba(79,236,236,0.07)"
  ],
  "json.schemas": [],
  "window.zoomLevel": 1,
  "git.enableSmartCommit": true,
  "settingsSync.ignoredExtensions": [],
  "editor.codeActionsOnSave": {},
  "javascript.updateImportsOnFileMove.enabled": "always",
  "java.jdt.ls.java.home": "C:\\Program Files\\Eclipse Adoptium\\jdk-17.0.5.8-hotspot",
  "java.configuration.runtimes": [],
  "rsp-ui.enableStartServerOnActivation": [
    {
      "id": "redhat.vscode-community-server-connector",
      "name": "Community Server Connector",
      "startOnActivation": true
    }
  ],
  "java.debug.settings.console": "internalConsole"
}

 

깃 예쁘게 꾸미기

comder>git config --global -e 엔터치면 vsc 열림

[core]
    editor = code
[user]
    name = 이름
    email = 이메일
[core]
    autocrlf = true
    editor = code --wait
[pull]
    rebase = false
[diff]
    tool = vscode
[difftool "vscode"]
    cmd = code --wait --diff $LOCAL $REMOTE
[merge]
    tool = vscode
[mergetool "vscode"]
    cmd = code --wait $MERGED
[alias]
    st = status
    hist = log --graph --all --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(white)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --date=short

git commit하기

                                                                                
                                                                                
D:\vscode_java\dev_java                                                         
$ git init                                                                      
Reinitialized existing Git repository in D:/vscode_java/dev_java/.git/          
                                                                                
D:\vscode_java\dev_java (master)                                                
$ git add .                                                                     
warning: in the working copy of 'app/src/main/java/dev_java/App.java', LF will b
ches it                                                                         
warning: in the working copy of 'app/src/test/java/dev_java/AppTest.java', LF wi
 touches it                                                                     
warning: in the working copy of 'gradle/wrapper/gradle-wrapper.properties', LF w
t touches it                                                                    
warning: in the working copy of 'gradlew', LF will be replaced by CRLF the next 
                                                                                
D:\vscode_java\dev_java (master)                                                
$ git status                                                                    
On branch master                                                                
                                                                                
No commits yet                                                                  
                                                                                
Changes to be committed:                                                        
  (use "git rm --cached <file>..." to unstage)                                  
        new file:   .gitattributes                                              
        new file:   .gitignore                                                  
        new file:   app/bin/main/dev_java/App.class                             
        new file:   app/bin/main/dev_java/ch01/Hello.class                      
        new file:   app/bin/test/dev_java/AppTest.class                         
        new file:   app/build.gradle                                            
        new file:   app/src/main/java/dev_java/App.java                         
        new file:   app/src/main/java/dev_java/ch01/Hello.java                  
        new file:   app/src/test/java/dev_java/AppTest.java                     
        new file:   gradle/wrapper/gradle-wrapper.jar                           
        new file:   gradle/wrapper/gradle-wrapper.properties                    
        new file:   gradlew                                                     
        new file:   gradlew.bat                                                 
        new file:   settings.gradle                                             
                                                                                
                                                                                
D:\vscode_java\dev_java (master)                                                
$ git commit                                                                    
Aborting commit due to empty commit message.                                    
                                                                                
D:\vscode_java\dev_java (master)                                                
$ git commit -m "kh자바수업소스"                                                      
[master (root-commit) d0cbd85] kh자바수업소스                                         
 14 files changed, 423 insertions(+)                                            
 create mode 100644 .gitattributes                                              
 create mode 100644 .gitignore                                                  
 create mode 100644 app/bin/main/dev_java/App.class                             
 create mode 100644 app/bin/main/dev_java/ch01/Hello.class                      
 create mode 100644 app/bin/test/dev_java/AppTest.class                         
 create mode 100644 app/build.gradle                                            
 create mode 100644 app/src/main/java/dev_java/App.java                         
 create mode 100644 app/src/main/java/dev_java/ch01/Hello.java                  
 create mode 100644 app/src/test/java/dev_java/AppTest.java                     
 create mode 100644 gradle/wrapper/gradle-wrapper.jar                           
 create mode 100644 gradle/wrapper/gradle-wrapper.properties                    
 create mode 100644 gradlew                                                     
 create mode 100644 gradlew.bat                                                 
 create mode 100644 settings.gradle                                             
                                                                                
D:\vscode_java\dev_java (master)                                                
$ git hist                                                                      
* [2022-11-30] [d0cbd85] | kh자바수업소스 {{dodoringring}}  (HEAD -> master)          
                                                                                
D:\vscode_java\dev_java (master)                                                
$

git add를 먼저 한 후 (내가 깃 하겠다는 의미)
git commit을 한다. 그러면 로컬에 올라감
그 후 git push를 하면 잔디가 찍힌다.

개시 branch 클릭 후 깃에 로그인 하면 정상적으로 업로드 되어 깃허브에서 확인 가능하다.

 

                                                                            
D:\git_221130 (master)                                                      
$ echo java >> a.txt                                                        
                                                                            
D:\git_221130 (master)                                                      
$ git st                                                                    
On branch master                                                            
Changes not staged for commit:                                              
  (use "git add <file>..." to update what will be committed)                
  (use "git restore <file>..." to discard changes in working directory)     
        modified:   a.txt                                                   
                                                                            
no changes added to commit (use "git add" and/or "git commit -a")           
                                                                            
D:\git_221130 (master)                                                      
$ git add a.txt                                                             
                                                                            
D:\git_221130 (master)                                                      
$ git st                                                                    
On branch master                                                            
Changes to be committed:                                                    
  (use "git restore --staged <file>..." to unstage)                         
        modified:   a.txt                                                   
                                                                            
                                                                            
D:\git_221130 (master)                                                      
$ git commit -m "2차 수정완료"                                                   
[master 49555ef] 2차 수정완료                                                    
 1 file changed, 1 insertion(+)                                             
                                                                            
D:\git_221130 (master)                                                      
$ git hist                                                                  
* [2022-11-30] [49555ef] | 2차 수정완료 {{dodoringring}}  (HEAD -> master)       
* [2022-11-30] [d37fc03] | at.txt작성완료 {{dodoringring}}                      
                                                                            
D:\git_221130 (master)                                                      
$

마무리로 깃에 업로드

user1@DESKTOP-C82RCDG MINGW64 /d/vscode_java/dev_java (master)
$ git add .

user1@DESKTOP-C82RCDG MINGW64 /d/vscode_java/dev_java (master)
$ git commit -m "11/30일 완료"
[master 3787f71] 11/30일 완료
 2 files changed, 8 insertions(+), 1 deletion(-)

user1@DESKTOP-C82RCDG MINGW64 /d/vscode_java/dev_java (master)
$ git push
Enumerating objects: 26, done.
Counting objects: 100% (26/26), done.
Delta compression using up to 12 threads
Compressing objects: 100% (9/9), done.
Writing objects: 100% (14/14), 1.60 KiB | 821.00 KiB/s, done.
Total 14 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/dodoringring/dev_java.git
   64e6c99..3787f71  master -> master

 

이제야 인스턴스이해가 가네^^
인스턴스화

Variable1 variable1 = new Variable1(); // variable이 클래스 급이다???
인스턴스화 하면 Heap영역에 저장된다->클래스랑 같이 저장된다. 클래스급이다.
 
암기하기!!!
1. 인스턴스변수명.변수명
이렇게 쓸수있는것은 전역변수만 가능하다
 
System.out.println(variable1.x);//순서 중요 인스턴스화 선언이 사용보다 앞에 와야한다.
    //인스턴스변수.전역변수 가능. 지역변수 노가능
 
2.static이 붙어있으면 클래스 타입 변수명을 적는다.
 
package dev_java.ch01;
//static은 변수앞에 메소드 앞에 올 수 있다.

//static이 있으면 정적변수, 정적 메소드라 한다.
//인스턴스화 없이 어디서나 호출할 수 있다.
//non-static에서 호출할 수  있다|없다

public class StaticExam2 {

  public static void main(String[] args) {
    StaticExam1 staticExam1 = new StaticExam1();
    StaticExam1 staticExam2 = new StaticExam1();
    StaticExam1 staticExam3 = new StaticExam1();
    staticExam1.methodA();
    staticExam2.i = 5;
    staticExam3.i = 3;
    System.out.println(staticExam1.i);// 1
    System.out.println(staticExam2.i);// 5
    System.out.println(staticExam3.i);// 1 ->3
  }
}
Footer
© 2022 GitHub, Inc.
Footer navigation
Terms​
 
문제!!!

이해할수있나요?? 아니오....ㅠ 내일 수업내용

package dev_java.ch01;

class Param {
  int ival;
}

public class TestParam {
  void effectParam(Param p) {
    // insert here - 여기에 p = new Param()이 있으면 결과가 달라진다 아니다 같다?????
    p = new Param();
    p.ival = 500;
    System.out.println("sub ival ===> " + p.ival);
  }

  public static void main(String[] args) {
    TestParam tp = new TestParam();
    Param p = new Param();
    tp.effectParam(p);
    System.out.println("main ival ===> " + p.ival);
  }
}

생각해봅시다.
순서는 메인 먼저
public static void main(String[] args) {
TestParam tp = new TestParam();//인스턴스화
Param p = new Param();//인스턴스화
tp.effectParam(p); //내가 위에서 인스턴스화 한 테스트 파람 클래스의 이펙트 파람을 사용하겠다. 근데 (p)를 꼭 넣어준다. 왜? 이펙트 파람 메소드에서 파라미터를 꼭 요구하니까. 파라미터 p를 넣어야 됨.
System.out.println("main ival ===> " + p.ival); // 이펙트 파람에서 p.ival값을 500이라함.
}

오늘 요약
Static 정적이다--->변하지 않는다---->공유가 가능하다
내 클래스 안이라도 Static이 없는 변수는 Static이 있는 메소드에서 사용할 수 없다.
사용하려면 1. 인스턴스화를 한다.
2. Static을 앞에 써준다.

댓글