Last week, I wrote about my job hunt process and what I have been doing during so. In this industry where one can never learn enough and know everything, it is important to familiarize yourself with the different patterns and styles of the many languages that exist. This has taught me how similar patterns can be and it all lies in the syntax.
This week I will walk through some of the parts I found most interesting while learning the basics of Java. A factor I always look for is the data types and their size to make sure my application is as efficient as it can be. For Java, I look to this Primitive Types diagram to use as a guide:
Another difference I have noticed across languages is in the CLI. In Java, we use the Scanner class which is used to get user input, and it is found in the java.util package.
Example:
To ask the users their age and return "You are __" with their input age.
Scanner scanner = new Scanner(System.in);
System.out.print("Enter your age: ");
byte yourAge = scanner.nextByte();
System.out.println("You are " + yourAge);
In general, these are notes that anyone starting to learn Java can use or come back to for a refresher on data types and user inputs.
Here is a link to the Java Tutorial for Beginners I used to get started!
Top comments (0)