Showing posts with label How To Declare A Variable In Java. Show all posts
Showing posts with label How To Declare A Variable In Java. Show all posts

Sunday, September 6, 2015

How To Use Variables In Java Programs Post 1

Hi All...!

Today I'm going to show you how to use Variables in Java Programming. I have shown you how to declare a variables and initialize a variable in my previous posts (How To Initialize Variable In Java, How To Declare A Variable In Java ). In this post I'm going to show you how to use Variables created by using "byte" data type.

Let's see how to do this coding,



This is the output,





Let's see how to add two byte values, here I'm going to use simple addition operator. Don't worry about that operator I will show you how to use those operator in Java in my upcoming posts.



 

Here comes the output,





Let's try to do this in another way,




Output,





Sunday, August 30, 2015

How To Declare A Variable In Java

Hi All...!

Today I'm going to show you how to declare a variable in Java. Following format is the common way to declare a variable in Java,

(Data Type)(Space)(Variable Name);


For a example,

int x;


Here "int" is the datatype (I will show you what are the datatype in Java in my upcoming posts) and the "x" is the variable name.