Variable Declaration

Image collected

So now as we know what is a variable in a programming language, we will know about how to use it as well.

A variable must have a name. Just like your notebook has a name on it. You can name the way you want but there are some rules to maintain. We will talk about that later.

For now, suppose the name of your variable is “a”

So how will we write that?

No, that is not the exact question for Computer Science.

You need to ask,

“How will we declare a variable?”

For that you need to mention the variable name obviously. Then you need to mention what is the value there. Or you can say what are you storing on the variable. Now the variables can hold different types of data. This is why you need to get different types of space (storage memory here) as well. So you need to mention the data type also.

For Java, you can declare a variable like this way,

int a = 5;

Here we are specifying

  1. The data type using int ( for Java, int defines an integer data type, we will know about that later).
  2. The variable name “a”.
  3. The value of the variable which is 5.

--

--

--

A Computer Science and Engineering student. Interested in Computer Science, business analytics ,research and editing.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Best of Level Up Coding (September 2020)

Putting out fires, never squashing bugs

7 Questions You Should Ask Your Outsourced Application Development Team

What Is the Best Folder Structure for Flutter Projects?

May & June Release Notes

PHP __sleep And __wakeup Magic Methods: How And When To Use Them?

Docker + ASP Net Core

How not to normalize the data in patternnet function and how to do K-fold cross validation…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Roy Aishwarjyo

Roy Aishwarjyo

A Computer Science and Engineering student. Interested in Computer Science, business analytics ,research and editing.

More from Medium

Compiler

Handlin Object Types

Multithreading In Python

Level-up Lists with List Comprehension!