-
(JAVA) Why scanner.close()?
Problem What is the precise reason for adding sc.close(); when I use Scanner class? import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Score: "); int score = sc.nextInt(); sc.close(); } } Reason Source java... Read More
-
Memo of Arrays in JAVA!
How to Declare an Array DATATYPE[] VARIABLE = {DATA1, DATA2, DATA3, ...}; DATATYPE[] VARIABLE = new DATATYPE[length_of_array]; DATATYPE[0] = value; DATATYPE[1] = value; ... Read More
-
(BOJ) Applying Conditional Operator
Problem BOJ No.9498 Solution Surely we can solve this by using if statements. But here’s a brand new perspective (for me) on this; using a multiple conditional operator. import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Score: ... Read More
-
(JAVA) Can't input using nextLine()
Problem import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("What is your name?: "); String name = scanner.nextLine(); System.out.print("How old are you?: "); int age = scanner.nextInt(); System.out... Read More
-
Github page is not updating a new post
Problem After writing (JAVA) Can’t input using nextLine(), this new buddy was well generated in my local server (localhost:4000), unfortunately not in the real github page… :( It took around 2hrs to fix this ordeal! Solution Check that the form of the file name (YEAR-MONTH-DAY-title.md) is written correctly. Try adding published: true t... Read More
-
Hi!
This is my first post :) I’m gonna upload anything I learned in programming. Read More