Computer Science | Intro to Java

Computer Science | Intro to Java


Hello everyone, welcome to the computer science section of Info Index. In this video I’ll be introducing some basic concepts of programming, as well as some general information for you to start your journey to becoming a computer scientist. The programming language that we’ll be using throughout the video is Java, and it is a very popular and beginner friendly coding language. The application that I will be using is Eclipse, although I do also recommend IntelliJ for programming in Java. So computer programming is based off of a combination of four actions: input storage process and output. For input we’re going to take an input from the console and to do this, we simply create what is called a scanner or buffered reader. We can get input by using built-in function of Java as part of the Scanner and BufferedReader class. For storage there are eight primitive data types on top of a special data type. First there is boolean. This is the smallest data type of all, since it can only hold one or two things: true or false. Then there are four whole number data types; from the smallest to largest: byte short int and long. These four each hold a whole number of different sizes. A byte can hold a number from negative 2^7 to 2^7 – 1. A short can hold a number from negative 2^15 to 2^15 – 1 and int can hold a number from negative 2^31 to 2^31 – 1. A Long can hold a number from negative 2^63 to 2^63 – 1. For decimals, Java gives two options to store them. One is float, which takes up 32 bits, and another is double, which takes up 64 bits. Java also has a data type that stores single characters called char. It stores it in the form of an ASCII value. An example of an ASCII table which shows a collection of ASCII values and their corresponding character such as: the ASCII value of 65 corresponds to the character of “a” and so on. The last type, which is string, is not a primitive data type. In Java, strings are implemented as objects, but in a lot of languages they are implemented as an array. However, for now just think of them as a collection of chars. Lastly, for output we will also be using the console, and to do so we invoke the function System.out.print or System.out.println with what we want to print inside the brackets. These two are similar yet different in the way that System.out.print will only print the argument but System.out.println will print the argument and it will also make the console go to the next line. And to end this video, We’ll be writing the most basic program that everyone writes as their first program, which is System.out.println Hello world. Now when we run that, save the project, hello world.

3 thoughts to “Computer Science | Intro to Java”

Leave a Reply

Your email address will not be published. Required fields are marked *