Skip to main content

Posts

Showing posts from 2018

Operators in Java

Let's start coding! This post is all about operators in Java. Previous we had learnt about how to declare variables, what are the data types, how to initialize variables, etc and now you might want to know what to do with them. Operators are a good place to start with Java programming. What are operators in Java? Operators are special symbols that perform some tasks/ operations on more than one variables called operands and returns a result. Assignment, Arithmetic and Unary Operators Simple Assignment Operator " = ": This is the most commom operator that you'll come across. It's primary purpose is to assign the value from it's right to the operand at its left. Eg: int count=1; Here the integer type of variable 'count' is assigned the value 1.

Variables, Data Types and Literals in Java

Hi! Lets continue with our next topic! VARIABLES What is a Variable? A variable is just like a bottle. A bottle can contain only liquid and it can be of any type i,e, water, juice, milk, etc. For example, a bottle is of size 1 ltr. and filled with water. Note that the type and quantity of liquid is now determined i.e. the bottle can contain only 1 ltr. of water and not more than that.Similarly, a variable is a fixed size container depending upon its data type.. It also compulsorily has a name. There are some naming conventions which will be discussed later on! (camel case). Let's see the types of variables! There are three types of variables : Local / Global variables Instance / reference variables Static variables DATA TYPES What are Data Types in Java? Java is a strongly typed language i.e. a variable needs a data type before it holds some data. If you want to fill a container and you dont know what is going to filled in that container, java compiler...

Internal Processes of Java Program

We already know that a java file i.e. the source code is to be converted into class file i.e. byte code.  Byte code is a highly optimized set of instructions designed to be runned/executed by something called Java Virtual Machine, the JVM. Earlier or you can say, originally JVM was only the interpreter for byte code. Why is Java needed?          Java solved the major problem of security and portability by converting the source code into bytecode. this bytecode can be executed anywhere provided JVM is implemented. The execution of bytecode or class file  by the JVM is the most simple way to create portable programs.                  Bytecode also makes Java, secure. Since there is only one condition for a java file(here bytecode) to execute successfully that is JVM should be implemented into the machine where the bytecode is going to be executed.  Without JVM, bytecode is not going to be ...