본문 바로가기

Programming/Java, Spring98

[Java 기초문법] Control flow | if 조건문, switch 조건문 [Java 기초문법] by Professional Java Developer Career Starter: Java Foundations @ Udemy if 조건문 1~3중 한 숫자를 랜덤으로 생성하고 그게 3이면 맞았다는 문장을 출력하는 코드를 짜보자. import java.util.Random; public class GuessIt { public static void main(String[] args) { int randomNum = new Random().nextInt(3) + 1; System.out.printf("Generated number is : %d", randomNum); if (randomNum ==3){ System.out.println("You got it!"); } } } Usi.. 2022. 10. 18.
[Java 기초문법] 자바 수학 연산 및 math 관련 함수들, 랜덤함수, 원의 너비 구하기, 구심력 구하기, BigDecimal, Calculting Compound Interest, formattin [Java 기초문법] by Professional Java Developer Career Starter: Java Foundations @ Udemy Math operations public class MathStuff { public static void main(String[] args) { System.out.println(8 * 8 / 8 /4); } } => 2 public class MathStuff { public static void main(String[] args) { System.out.println(7 / 4); } } => 1 = fractional parts just thrown up public class MathStuff { public static void main(Stri.. 2022. 10. 18.
[Java 기초문법] 숫자 다루기 | Data types , double and floats 사용시 주의할 점, 진법 표현들 [Java 기초문법] by Professional Java Developer Career Starter: Java Foundations @ Udemy Data types BYTE (-128 to 127) 아스키코드에서 A가 65에 assgined 된 것을 확인했다. random하게 된 것이 아니라는 점. 컴퓨터가 글자를 숫자로 인식하는 방식의 가장 lowest level은 bits 단위를 보는 것이다. 8 bits = 1 BYTE 이진법으로 65는 8 7 6 5 4 3 2 1 128 64 32 16 8 4 2 1 0 1 0 0 0 0 0 1 Hexadecimal 에서 FACE는 ? E = 1110 C = 1100 A = 1010 F = 1111 public class NumberStuff { public.. 2022. 10. 18.
[Java 기초문법] 정규식 다루기 | Regex | transcript에서 element 추출해보기, greedy operator 사용시 주의할점, finding method [Java 기초문법] by Professional Java Developer Career Starter: Java Foundations @ Udemy Real Text Parsing import java.util.regex.Matcher; import java.util.regex.Pattern; public class TranscriptParser { public static void main(String[] args) { String transcript = """ Student Number: 1234598872 Grade: 11 Birthdate: 01/02/2000 Gender: M State ID: 8923827123 Cumulative GPA (Weighted) 3.82 Cumulative GPA.. 2022. 10. 18.
[Java 기초문법] 정규식 다루기 | Regex | 기초 표현, Capture Groups , Comments, 여러가지 표현들 [Java 기초문법] by Professional Java Developer Career Starter: Java Foundations @ Udemy Regex 기초 표현 public class RegexPractice { public static void main(String[] args) { System.out.println("cat".matches("cat")); } } 리턴 true concept of character classes System.out.println("Cat".matches("[cC]at")); MEANING => if this word starts with a lower case c or an uppercase C = > matches bracket = [] 를 사용해서 범위를.. 2022. 10. 18.