We perform addition by using +
operator on numeric data types
int num1 = 5;
int num2 = 6;
int sum = num1 + num2;
System.out.println(sum); // 11int num3 = sum + 10;
System.out.println(num3); // 21num3 = num3 + 1;
System.out.println(num3); // 22
We perform addition by using —
operator on numeric data types
int num1 = 5;
int num2 = 6;
int sum = num2 - num1;
System.out.println(sum); // 1int num3 = 100 - sum;
System.out.println(num3); // 99num3 = num3 - 10;
System.out.println(num3); // 89
We perform multiplication…
It’s time to create a method
A method is a block of code that can be executed when it’s called by its name. The methods are actions in the program. Also, it’s useful to think that method is a separate program that has input, process, and output.
The core idea of creating methods is reusability. We can create a method once and reuse it many times. However, be careful to create extremely generic methods. These kinds of methods are messy and hard to read. The method should solve only one problem.
They are so primitive that I keep forgetting about them
First, let’s talk about variables, and then we will slowly jump to primitives in java.
Variable is a container that can hold a piece of data. We can think of the variable as a box where we can put different staff and take them when we need them. Also, we can put a label on our box so we don’t get confused with other boxes. Finally, we can get different types of boxes for different goods. For books, we will have one, for clothes we will have another one.
In…
There are two types of programming languages. The low-level programming languages and high-level.
The low-level languages are very close to instructions that directly understandable by a machine. Sometimes, we refer to them as an assembly language or machine code.
In another hand, high-level programming languages have a syntax that understandable by humans. We know, machines can only understand binary code (0 and 1) so in order to run our program, we will need to first translate it into binary code. The process of translating our source code written in the high-level language to byte code called a compilation. A compilation…
We didn’t always have a nice-looking interface on our screen
In this article, we will learn how to work with a terminal on your laptop/pc. Note, this is a beginner's tutorial.
We didn’t always have a nice-looking interface on our screen where we could move the mouse around, click things to open or drag things to different locations, and so on. Early days of computers we used to send specific commands to our computer through a terminal and the computer would take this command read it and execute it accordingly.
In the IT world, we still use a terminal daily…
There are many operating systems nowadays. The most popular ones are Microsoft Windows, macOS, and Linux.
Your program will do exactly what you tell to do. Nothing extra and nothing less.
Assuming you are just starting your journey in this field - it is tough. Sometimes you just want to throw your laptop away with the words “F*CK these small dots, variables, and everything together!”.
To start, continue, and finish strong make programming part of your life. Involve with our community. Watch news and movies about it. Socialize with your classmates.
A program is a set of instructions that can be executed by a computer to perform a specific task. Your program will do exactly what…
Learn how to work with exceptions in Java
Exception in Java:
An exception is a mechanism in Java to handle unexpected situations. Most of the time unexpected situation is unexpected input.
Well, it’s not really an online compiler. It is a system that allows practicing Java coding from the Web.
I’m working as a Java instructor at Tech Lead Academy. Right from the beginning, I realize, I need an automated system to validate students' code and which will help them practice. CodingBat was a perfect solution to start. While CodingBat is the best platform, it had few disadvantages in our case. Firstly, I wasn’t able to see how does class is doing on assignments I give from CodingBat. Secondly, in the CodingBat we don’t have a very beginning stage where students…
The collection framework is a framework to work with a collection of data in Java.
If you are new to programming then you need to start with Array which is a core data structure to work with a collection of data.
The collection framework is a set of interfaces and concrete classes. We can use it to store and manipulate a group of objects. It supports built-in sorting and searching algorithms. We can say that the collection framework is ready APIS for various data structures. The collection framework is in core java libraries. We just need to import them from…