-
002. 메모장 코딩 (FirstJavaProgram.java), JVM(자바가상머신)SsY/Class 2023. 2. 11. 15:22728x90
2023.01.26 (목)
메모장 코딩 (FirstJavaProgram.java)
1. 새 메모장을 열고 다른이름으로 저장
- FirstJavaProgram.java
* 001.환경설정에서의 모든 확장자 보이기 설정을 해두었다면 java파일로 멀쩡하게 생성된 것을 확인할 수 있다.
(이 때, 확장자명이 .java가 아니라 .txt가 되어있다면 파일이름 변경키(F2)를 눌러 .txt를 지우고 다시 저장할 것)public class FirstJavaProgram { public static void main(String[] args) { System.out.println("Welcome to Java"); System.out.println("First Java Program"); } }
2. 해당 FirstJavaProgram.java 메모장에 상기 내용을 입력하고 저장 (ctrl +s)
3. 프로그램이 실행되는지 확인
1) win + R > cmd입력 하여 명령프롬프트 창 실행
2) cd\ // 최상위 루트로 이동
3) cd JavaStudy // 해당 디렉토리로 이동
4) javac FirstJavaProgram.java // 자바 파일 컴파일 하기 (실행시 출력문 X 넘어감)
=> JavaStudy 폴더 내에 FirstJavaProgram.class 파일이 생성되어 있다면 OK
5) java FirstJavaProgram // 컴파일 된 파일을 java 로 실행
=> 멀쩡하게 컴파일 되었다면 아래와 같이 출력됨을 볼 수 있다.
* 이 때, java.exe 는 .class 파일만을 읽어오기 때문에 FirstJavaProgram.class 와 같이 .class를 입력하는 것이 문법오류가 된다.JVM (자바가상머신)
- 자바 프로그램은 운영체제에 독립적 (OS영향 (X))
- 자바 가상머신은 운영체제에 의존적 (OS가 변하면 - 따라서 변함)
- 자바의 속도가 느리다 ?
최근 기술의 발전으로 속도가 유의미하게 향상되었음
또한, 개발중인 소프트웨어의 90% 이상은 인터넷, 네트워크 기반 소프트웨어로 속도보다는 데이터 전송속도가 중요하다.
자바의 속도에 문제가 있다면 자바 자체의 문제보다 데이터베이스의 문제일 가능성이 높다.// 개인적 감상
더보기메모장을 이용하면서도 이렇게 코딩을 할 수 있다는 것을 처음 알게 되었고 입력한 내용의 원리는 잘 모르지만 일단 따라 적어보는 것으로 시작했는데 출력되는것도 신기했다.
728x90'SsY > Class' 카테고리의 다른 글
005. 비트 연산자, 변수와 자료형 / 키워드 및 식별자 / 연산자 실습, final(상수화) (0) 2023.02.15 004. 음의 정수 표현(2의 보수), 실수 표현 방식의 이해, 상수와 형 변환, 연산자 (0) 2023.02.11 003. EditPlus , 자바의 기본 프로그래밍 & 자료형 (1) 2023.02.11 001. 기초 환경 설정 (1) 2023.02.11 000. 쌍용강북교육센터 국비지원 자바과정 면접 및 OT (2) 2023.02.11