SlideShare a Scribd company logo
1 of 6
Download to read offline
VARIABLES AND DATA TYPES
Tuğçe ARSLAN
Variables are held in memory in different formats depending on the type they are assigned
to, and these types have different sizes from each other. The software is generally designed to
process data and present the result to the user. However, the user can request data, or oper-
ations can be performed entirely on the values kept in memory. Variables, data are stored in
RAM (Random Access Memory) for a short time.
In real life, data is used for classification. Classification is
usually done according to the Types of Data.
Variables are structures that store temporary information in programming and are deter-
mined by the programmer. Variables form the basic structure of programming, and it is a struc-
ture used in all programming languages. Thanks to the variables, we keep the operations we
do in the program in memory and exploit them where necessary.
Variables have four properties; Data Type, Name, Value, and Address.
In Variables, Data Type, as the name suggests, indicates the type of data to be stored,
which can be numbers, words, and programmatic fields. Each variable has a unique character
from which it is used and called within the program. We assign a value to these variables; our
operating system keeps this variable in memory and sets an address.
Variables in Java have Data Types. These types can be primitive ones defined by default in
Java or non–primitive ones described by the developers themselves. Primitive types always have
value. Non–primitive types can be “null.” While non–primitive types all have the same size, the
size of primitive data types depends on the data type they will receive.
anumak.ai
In Classical Languages, basic Data Types such as integers, fractional numbers, boolean,
void, char, and composite Data Types such as string and array are built–in–types in the pro-
gramming language, each specified by a keyword. Whereas, in Object–Oriented Program-
ming Languages, each type is a class. However, primitive Data Types are used very often when
writing programs. Therefore, Object–Oriented Languages give an exception to such Data
Types. The Java language allows these data types to be used without creating objects belong-
ing to them. This makes it easier to write programs and speeds up.
The Java compiler automatically embeds (wrapping, boxing) each defined primitive data in
the class it belongs to, when necessary. Boxing puts a primitive variable into the category it be-
longs to and turns it into a variable belonging to an object. In other words, it is the conversion
of a primitive type to a reference type. Unboxing is the reverse process: Converting a boxed
variable back to a primitive data type. The java compiler does both things by itself, without the
programmer’s intervention.
Why Data Type?
We may need to handle different Data Types in a program. For example, integers, fraction-
al numbers, characters (letters and other symbols on the keyboard), text (string), logical (bool-
ean) values (true=true, false=false) are the different data types that come to mind first. These
additional data types differ in size (the number of bits they will occupy in memory) and the
operations that can be done. For example, we can do four functions with numbers but not texts.
Therefore, Java and some other languages separate data into types. Defining a variable speci-
fies which type of data it will hold. Thus, it allocates enough space for that variable in the main
memory and allows operations to be performed according to that Data Type.
anumak.ai
What is a Variable?
In a computer program, Variables are the names (identities) given to them to distinguish the
data used in the program from each other. Giving each data a separate name prevents them
from getting confused. It is the same in everyday life.
For compilers, it doesn’t matter whether the names given to the Variables are short or long,
meaningful or meaningless. However, it is appropriate to provide them with meaningful names
so that the source program writer and reader can easily understand what the Variables repre-
sent. Of course, this is not a problem in short programs, even single letter names are given, and
it is primarily convenient. But in extended programs, it is easy to understand and preferable to
name Variables with names that indicate the data they represent.
Technically speaking, a Variable is an address in the main memory
where values of a particular Data Type can be entered.
Variables are tools that carry the raw Data Types of the program. There are no global Vari-
ables in Java. Instead, each Variable is defined in a class or a block in the class. Those de-
scribed in the class become a class members of the class in which it is defined. Those defined
within an inner block within the type become the local Variable of that inner block.
Each Variable is allocated a place in the main memory large enough for the Data Type to
hold that Variable. This place is called the address of the Variable in the main memory. Each
Variable is given a name. Using this name, the Variable can be assigned a value, the set value
can be read, and the assigned value can be changed (updated). Accessing a Variable means
assigning a value to that Variable, reading the set value, and changing the given value at will.
Java is a type–protected language. In other words, the Java language separates the Data
Types to be held by the Variables to be used in the program with strict limits. In this respect,
it is similar to C and C++ languages. Therefore, when declaring a Variable, the Data Type of
that Variable is strictly specified. Then the data assigned to that variable cannot go outside the
selected data type. An exception to this is when, in some cases, the data held by a Variable is
converted to another type.
anumak.ai
ANUMAK & COMPANY
aNumak & Company is a global management consulting firm, an India private company
limited by warranty. It is a company with expertise in creating scalable business models for
different industry verticals. The Company strives to provide solutions through consulting, digital
transformation, and innovative products that solve modern business problems. Offering on–
site and offshore support and unique strategies, aNumak & Company transforms traditional
business models into high–performance, dynamic, and distinctive business enterprises. It brings
insights from core domain experts to deliver the best possible solutions to drive growth. aNumak
& Company and each of its member firms are legally separate and independent entities. For
more detailed information about aNumak & Company and its member companies, please visit
https://www.anumak.com
This material was prepared by aNumak & Company. This material (including any information it
contains) is intended to provide general information on a particular topic(s). This material may
contain information obtained from publicly available information or other third–party sources.
aNumak & Company does not independently verify such sources and is not responsible for any
loss resulting from reliance on information obtained from such sources. aNumak & Company
does not provide any investment, legal, or other professional advice or services through this
material. You should seek specific advice from the relevant specialist(s) for such services.
This material or information is not intended to be considered the sole basis for any decision
that could affect you, your business, or the operations of the company. Before making any
decision or taking any action that could affect your finances or business, you should consult a
professional.
No institution at aNumak & Company can be held responsible for any loss suffered by any
person or institution due to access to, use, or reliance on this material. By using this material or
any information it contains, the user accepts he entirety of this notice and
the terms of use.
©2022 aNumak & Company
anumak.ai
Amith Kumar
Chief Executive Officer,
aNumak & Company
amith@anumak.com
Neha Anush
Chief Operating Officer,
aNumak & Company
neha.anush@anumak.com
Tuǧçe ARSLAN
Chief Content Officer and PR
aNumak & Company
arslan@anumak.in
Cesibel Rodriguez
Chief Branding Officer,
aNumak & Company
cesi@anumak.com
Ricky Devaya
Chief Human Resource Officer – India,
aNumak & Company
ricky@anumak.com
Vilas Khole
Chief Delivery Officer – India,
aNumak & Company
vilas@anumak.com
Karthik Reddy
Chief Sales Officer – UAE,
aNumak & Company
karthik@anumak.in
Iván Muñiz Rothgiesser
Sales Director,
aNumak & Company
ivan@anumak.com
Gino Mori Valenzuela
Client Partner – Retail,
aNumak & Company
gino@anumak.in
Diana Marcela Rios
Client Partner – Retail,
aNumak & Company
diana@anumak.in
aNumak & Company
marketing@anumak.com
Pr@anumak.in - info@anumak.com
Víctor Freundt
Client Partner – Education,
aNumak & Company
victor@anumak.in
Agyemang Mensah Kwadwo
Graphic Designer,
aNumak & Company
agyemang@anumak.in
anumak.ai
CONTACTS CONTRIBUTORS

More Related Content

Similar to Variables And Data Types

Maintenance of Dynamically vs. Statically typed Languages
Maintenance of Dynamically vs. Statically typed LanguagesMaintenance of Dynamically vs. Statically typed Languages
Maintenance of Dynamically vs. Statically typed Languages
Amin Bandeali
 
Language design and translation issues
Language design and translation issuesLanguage design and translation issues
Language design and translation issues
SURBHI SAROHA
 

Similar to Variables And Data Types (20)

Flutter.pdf
 Flutter.pdf Flutter.pdf
Flutter.pdf
 
java handout.doc
java handout.docjava handout.doc
java handout.doc
 
502 Object Oriented Analysis and Design.pdf
502 Object Oriented Analysis and Design.pdf502 Object Oriented Analysis and Design.pdf
502 Object Oriented Analysis and Design.pdf
 
Java Developer_ The Unsung Hero of Enterprise-Level Software Development (4).pdf
Java Developer_ The Unsung Hero of Enterprise-Level Software Development (4).pdfJava Developer_ The Unsung Hero of Enterprise-Level Software Development (4).pdf
Java Developer_ The Unsung Hero of Enterprise-Level Software Development (4).pdf
 
leewayhertz.com-What role do embeddings play in a ChatGPT-like model.pdf
leewayhertz.com-What role do embeddings play in a ChatGPT-like model.pdfleewayhertz.com-What role do embeddings play in a ChatGPT-like model.pdf
leewayhertz.com-What role do embeddings play in a ChatGPT-like model.pdf
 
Advanced Document Management System for Education Industry
Advanced Document Management System for Education IndustryAdvanced Document Management System for Education Industry
Advanced Document Management System for Education Industry
 
pembelajaran tentang dart dalam bahasa inggris
pembelajaran tentang dart dalam bahasa inggrispembelajaran tentang dart dalam bahasa inggris
pembelajaran tentang dart dalam bahasa inggris
 
Introduction to Core Java Programming
Introduction to Core Java ProgrammingIntroduction to Core Java Programming
Introduction to Core Java Programming
 
Maintenance of Dynamically vs. Statically typed Languages
Maintenance of Dynamically vs. Statically typed LanguagesMaintenance of Dynamically vs. Statically typed Languages
Maintenance of Dynamically vs. Statically typed Languages
 
Class notes(week 2) on basic concepts of oop-2
Class notes(week 2) on basic concepts of oop-2Class notes(week 2) on basic concepts of oop-2
Class notes(week 2) on basic concepts of oop-2
 
Language design and translation issues
Language design and translation issuesLanguage design and translation issues
Language design and translation issues
 
Class notes(week 2) on basic concepts of oop-2
Class notes(week 2) on basic concepts of oop-2Class notes(week 2) on basic concepts of oop-2
Class notes(week 2) on basic concepts of oop-2
 
Patton user modeling
Patton user modelingPatton user modeling
Patton user modeling
 
project on Agile approach
project on Agile approachproject on Agile approach
project on Agile approach
 
ICT.docx
 ICT.docx ICT.docx
ICT.docx
 
It project 1
It project 1It project 1
It project 1
 
Automating and Validating Semantic Annotations.pdf
Automating and Validating Semantic Annotations.pdfAutomating and Validating Semantic Annotations.pdf
Automating and Validating Semantic Annotations.pdf
 
Criteria for selecting ERP Software Vendors
Criteria for selecting ERP Software VendorsCriteria for selecting ERP Software Vendors
Criteria for selecting ERP Software Vendors
 
Ibm watson boston meetup may 27 2015
Ibm watson boston meetup may 27 2015Ibm watson boston meetup may 27 2015
Ibm watson boston meetup may 27 2015
 
Crafting Your Customized Legal Mastery: A Guide to Building Your Private LLM
Crafting Your Customized Legal Mastery: A Guide to Building Your Private LLMCrafting Your Customized Legal Mastery: A Guide to Building Your Private LLM
Crafting Your Customized Legal Mastery: A Guide to Building Your Private LLM
 

More from aNumak & Company

More from aNumak & Company (20)

The Challenges Of Multi-cloud Management.pdf
The Challenges Of Multi-cloud Management.pdfThe Challenges Of Multi-cloud Management.pdf
The Challenges Of Multi-cloud Management.pdf
 
5 Pillars Of Effective Data Management In Modern Data Systems.pdf
5 Pillars Of Effective Data Management In Modern Data Systems.pdf5 Pillars Of Effective Data Management In Modern Data Systems.pdf
5 Pillars Of Effective Data Management In Modern Data Systems.pdf
 
How CFOs Are Helping Corporations Integrate ESG Into Their Business Strategie...
How CFOs Are Helping Corporations Integrate ESG Into Their Business Strategie...How CFOs Are Helping Corporations Integrate ESG Into Their Business Strategie...
How CFOs Are Helping Corporations Integrate ESG Into Their Business Strategie...
 
Impact Of Industry 4.0 Technologies On Business Development And Management.pdf
Impact Of Industry 4.0 Technologies On Business Development And Management.pdfImpact Of Industry 4.0 Technologies On Business Development And Management.pdf
Impact Of Industry 4.0 Technologies On Business Development And Management.pdf
 
The Future Of Smart Technology And Its Effect On Business performance.pdf
The Future Of Smart Technology And Its Effect On Business performance.pdfThe Future Of Smart Technology And Its Effect On Business performance.pdf
The Future Of Smart Technology And Its Effect On Business performance.pdf
 
The effects of Industry 5.pdf
The effects of Industry 5.pdfThe effects of Industry 5.pdf
The effects of Industry 5.pdf
 
Importance Of The Dignity Of Compliance Risk In Organizations.pdf
Importance Of The Dignity Of Compliance Risk In Organizations.pdfImportance Of The Dignity Of Compliance Risk In Organizations.pdf
Importance Of The Dignity Of Compliance Risk In Organizations.pdf
 
NEXT GENERATION SOFTWARE DEVELOPMENT.pdf
NEXT GENERATION SOFTWARE DEVELOPMENT.pdfNEXT GENERATION SOFTWARE DEVELOPMENT.pdf
NEXT GENERATION SOFTWARE DEVELOPMENT.pdf
 
Getting Through the Fear Factor When Hiring Tech Talents.pdf
Getting Through the Fear Factor When Hiring Tech Talents.pdfGetting Through the Fear Factor When Hiring Tech Talents.pdf
Getting Through the Fear Factor When Hiring Tech Talents.pdf
 
Rebuilding social capital and improving business performance.pdf
Rebuilding social capital and improving business performance.pdfRebuilding social capital and improving business performance.pdf
Rebuilding social capital and improving business performance.pdf
 
How Advanced Connectivity__ affects the prospects of the market trends today.pdf
How Advanced Connectivity__ affects the prospects of the market trends today.pdfHow Advanced Connectivity__ affects the prospects of the market trends today.pdf
How Advanced Connectivity__ affects the prospects of the market trends today.pdf
 
How Praise And recognition affect bottom line.pdf
How Praise And recognition affect bottom line.pdfHow Praise And recognition affect bottom line.pdf
How Praise And recognition affect bottom line.pdf
 
DANGERS OF TOXIC WORKPLACE.pdf
DANGERS OF TOXIC WORKPLACE.pdfDANGERS OF TOXIC WORKPLACE.pdf
DANGERS OF TOXIC WORKPLACE.pdf
 
How To Build Mentally Resilience Workforce for An Organization.pdf
How To Build Mentally Resilience Workforce for An Organization.pdfHow To Build Mentally Resilience Workforce for An Organization.pdf
How To Build Mentally Resilience Workforce for An Organization.pdf
 
FUTURE OF RETAIL WILL LOOK LIKE WHAT'S HAPPENED IN THE MUSIC INDUSTRY.pdf
FUTURE OF RETAIL WILL LOOK LIKE WHAT'S HAPPENED IN THE MUSIC INDUSTRY.pdfFUTURE OF RETAIL WILL LOOK LIKE WHAT'S HAPPENED IN THE MUSIC INDUSTRY.pdf
FUTURE OF RETAIL WILL LOOK LIKE WHAT'S HAPPENED IN THE MUSIC INDUSTRY.pdf
 
Localization of data privacy laws creates opportunities for competition.pdf
Localization of data privacy laws creates opportunities for competition.pdfLocalization of data privacy laws creates opportunities for competition.pdf
Localization of data privacy laws creates opportunities for competition.pdf
 
How a Revamped Data Analytics Approach Can Mitigate Healthcare Disparities.pdf
How a Revamped Data Analytics Approach Can Mitigate Healthcare Disparities.pdfHow a Revamped Data Analytics Approach Can Mitigate Healthcare Disparities.pdf
How a Revamped Data Analytics Approach Can Mitigate Healthcare Disparities.pdf
 
Effects of High Inflation on Private Equity Performance in Business.pdf
Effects of High Inflation on Private Equity Performance in Business.pdfEffects of High Inflation on Private Equity Performance in Business.pdf
Effects of High Inflation on Private Equity Performance in Business.pdf
 
How Low-code Can Help Businesses Automate IoT In Their Business.pdf
How Low-code Can Help Businesses Automate IoT In Their Business.pdfHow Low-code Can Help Businesses Automate IoT In Their Business.pdf
How Low-code Can Help Businesses Automate IoT In Their Business.pdf
 
How the CEO's visionary leadership can tip the scales in favor of success in ...
How the CEO's visionary leadership can tip the scales in favor of success in ...How the CEO's visionary leadership can tip the scales in favor of success in ...
How the CEO's visionary leadership can tip the scales in favor of success in ...
 

Recently uploaded

一比一原版西悉尼大学毕业证成绩单如何办理
一比一原版西悉尼大学毕业证成绩单如何办理一比一原版西悉尼大学毕业证成绩单如何办理
一比一原版西悉尼大学毕业证成绩单如何办理
pyhepag
 
Abortion pills in Dammam Saudi Arabia// +966572737505 // buy cytotec
Abortion pills in Dammam Saudi Arabia// +966572737505 // buy cytotecAbortion pills in Dammam Saudi Arabia// +966572737505 // buy cytotec
Abortion pills in Dammam Saudi Arabia// +966572737505 // buy cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
pyhepag
 
Fuzzy Sets decision making under information of uncertainty
Fuzzy Sets decision making under information of uncertaintyFuzzy Sets decision making under information of uncertainty
Fuzzy Sets decision making under information of uncertainty
RafigAliyev2
 
一比一原版纽卡斯尔大学毕业证成绩单如何办理
一比一原版纽卡斯尔大学毕业证成绩单如何办理一比一原版纽卡斯尔大学毕业证成绩单如何办理
一比一原版纽卡斯尔大学毕业证成绩单如何办理
cyebo
 
一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理
pyhepag
 
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Valters Lauzums
 
一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理
一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理
一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理
pyhepag
 

Recently uploaded (20)

一比一原版西悉尼大学毕业证成绩单如何办理
一比一原版西悉尼大学毕业证成绩单如何办理一比一原版西悉尼大学毕业证成绩单如何办理
一比一原版西悉尼大学毕业证成绩单如何办理
 
Machine Learning for Accident Severity Prediction
Machine Learning for Accident Severity PredictionMachine Learning for Accident Severity Prediction
Machine Learning for Accident Severity Prediction
 
Easy and simple project file on mp online
Easy and simple project file on mp onlineEasy and simple project file on mp online
Easy and simple project file on mp online
 
Pre-ProductionImproveddsfjgndflghtgg.pptx
Pre-ProductionImproveddsfjgndflghtgg.pptxPre-ProductionImproveddsfjgndflghtgg.pptx
Pre-ProductionImproveddsfjgndflghtgg.pptx
 
Supply chain analytics to combat the effects of Ukraine-Russia-conflict
Supply chain analytics to combat the effects of Ukraine-Russia-conflictSupply chain analytics to combat the effects of Ukraine-Russia-conflict
Supply chain analytics to combat the effects of Ukraine-Russia-conflict
 
How I opened a fake bank account and didn't go to prison
How I opened a fake bank account and didn't go to prisonHow I opened a fake bank account and didn't go to prison
How I opened a fake bank account and didn't go to prison
 
Generative AI for Trailblazers_ Unlock the Future of AI.pdf
Generative AI for Trailblazers_ Unlock the Future of AI.pdfGenerative AI for Trailblazers_ Unlock the Future of AI.pdf
Generative AI for Trailblazers_ Unlock the Future of AI.pdf
 
Abortion pills in Dammam Saudi Arabia// +966572737505 // buy cytotec
Abortion pills in Dammam Saudi Arabia// +966572737505 // buy cytotecAbortion pills in Dammam Saudi Arabia// +966572737505 // buy cytotec
Abortion pills in Dammam Saudi Arabia// +966572737505 // buy cytotec
 
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
 
Fuzzy Sets decision making under information of uncertainty
Fuzzy Sets decision making under information of uncertaintyFuzzy Sets decision making under information of uncertainty
Fuzzy Sets decision making under information of uncertainty
 
Atlantic Grupa Case Study (Mintec Data AI)
Atlantic Grupa Case Study (Mintec Data AI)Atlantic Grupa Case Study (Mintec Data AI)
Atlantic Grupa Case Study (Mintec Data AI)
 
Data Visualization Exploring and Explaining with Data 1st Edition by Camm sol...
Data Visualization Exploring and Explaining with Data 1st Edition by Camm sol...Data Visualization Exploring and Explaining with Data 1st Edition by Camm sol...
Data Visualization Exploring and Explaining with Data 1st Edition by Camm sol...
 
2024 Q2 Orange County (CA) Tableau User Group Meeting
2024 Q2 Orange County (CA) Tableau User Group Meeting2024 Q2 Orange County (CA) Tableau User Group Meeting
2024 Q2 Orange County (CA) Tableau User Group Meeting
 
一比一原版纽卡斯尔大学毕业证成绩单如何办理
一比一原版纽卡斯尔大学毕业证成绩单如何办理一比一原版纽卡斯尔大学毕业证成绩单如何办理
一比一原版纽卡斯尔大学毕业证成绩单如何办理
 
一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理
 
Slip-and-fall Injuries: Top Workers' Comp Claims
Slip-and-fall Injuries: Top Workers' Comp ClaimsSlip-and-fall Injuries: Top Workers' Comp Claims
Slip-and-fall Injuries: Top Workers' Comp Claims
 
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
 
社内勉強会資料  Mamba - A new era or ephemeral
社内勉強会資料   Mamba - A new era or ephemeral社内勉強会資料   Mamba - A new era or ephemeral
社内勉強会資料  Mamba - A new era or ephemeral
 
一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理
一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理
一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理
 
basics of data science with application areas.pdf
basics of data science with application areas.pdfbasics of data science with application areas.pdf
basics of data science with application areas.pdf
 

Variables And Data Types

  • 1. VARIABLES AND DATA TYPES Tuğçe ARSLAN
  • 2. Variables are held in memory in different formats depending on the type they are assigned to, and these types have different sizes from each other. The software is generally designed to process data and present the result to the user. However, the user can request data, or oper- ations can be performed entirely on the values kept in memory. Variables, data are stored in RAM (Random Access Memory) for a short time. In real life, data is used for classification. Classification is usually done according to the Types of Data. Variables are structures that store temporary information in programming and are deter- mined by the programmer. Variables form the basic structure of programming, and it is a struc- ture used in all programming languages. Thanks to the variables, we keep the operations we do in the program in memory and exploit them where necessary. Variables have four properties; Data Type, Name, Value, and Address. In Variables, Data Type, as the name suggests, indicates the type of data to be stored, which can be numbers, words, and programmatic fields. Each variable has a unique character from which it is used and called within the program. We assign a value to these variables; our operating system keeps this variable in memory and sets an address. Variables in Java have Data Types. These types can be primitive ones defined by default in Java or non–primitive ones described by the developers themselves. Primitive types always have value. Non–primitive types can be “null.” While non–primitive types all have the same size, the size of primitive data types depends on the data type they will receive. anumak.ai
  • 3. In Classical Languages, basic Data Types such as integers, fractional numbers, boolean, void, char, and composite Data Types such as string and array are built–in–types in the pro- gramming language, each specified by a keyword. Whereas, in Object–Oriented Program- ming Languages, each type is a class. However, primitive Data Types are used very often when writing programs. Therefore, Object–Oriented Languages give an exception to such Data Types. The Java language allows these data types to be used without creating objects belong- ing to them. This makes it easier to write programs and speeds up. The Java compiler automatically embeds (wrapping, boxing) each defined primitive data in the class it belongs to, when necessary. Boxing puts a primitive variable into the category it be- longs to and turns it into a variable belonging to an object. In other words, it is the conversion of a primitive type to a reference type. Unboxing is the reverse process: Converting a boxed variable back to a primitive data type. The java compiler does both things by itself, without the programmer’s intervention. Why Data Type? We may need to handle different Data Types in a program. For example, integers, fraction- al numbers, characters (letters and other symbols on the keyboard), text (string), logical (bool- ean) values (true=true, false=false) are the different data types that come to mind first. These additional data types differ in size (the number of bits they will occupy in memory) and the operations that can be done. For example, we can do four functions with numbers but not texts. Therefore, Java and some other languages separate data into types. Defining a variable speci- fies which type of data it will hold. Thus, it allocates enough space for that variable in the main memory and allows operations to be performed according to that Data Type. anumak.ai
  • 4. What is a Variable? In a computer program, Variables are the names (identities) given to them to distinguish the data used in the program from each other. Giving each data a separate name prevents them from getting confused. It is the same in everyday life. For compilers, it doesn’t matter whether the names given to the Variables are short or long, meaningful or meaningless. However, it is appropriate to provide them with meaningful names so that the source program writer and reader can easily understand what the Variables repre- sent. Of course, this is not a problem in short programs, even single letter names are given, and it is primarily convenient. But in extended programs, it is easy to understand and preferable to name Variables with names that indicate the data they represent. Technically speaking, a Variable is an address in the main memory where values of a particular Data Type can be entered. Variables are tools that carry the raw Data Types of the program. There are no global Vari- ables in Java. Instead, each Variable is defined in a class or a block in the class. Those de- scribed in the class become a class members of the class in which it is defined. Those defined within an inner block within the type become the local Variable of that inner block. Each Variable is allocated a place in the main memory large enough for the Data Type to hold that Variable. This place is called the address of the Variable in the main memory. Each Variable is given a name. Using this name, the Variable can be assigned a value, the set value can be read, and the assigned value can be changed (updated). Accessing a Variable means assigning a value to that Variable, reading the set value, and changing the given value at will. Java is a type–protected language. In other words, the Java language separates the Data Types to be held by the Variables to be used in the program with strict limits. In this respect, it is similar to C and C++ languages. Therefore, when declaring a Variable, the Data Type of that Variable is strictly specified. Then the data assigned to that variable cannot go outside the selected data type. An exception to this is when, in some cases, the data held by a Variable is converted to another type. anumak.ai
  • 5. ANUMAK & COMPANY aNumak & Company is a global management consulting firm, an India private company limited by warranty. It is a company with expertise in creating scalable business models for different industry verticals. The Company strives to provide solutions through consulting, digital transformation, and innovative products that solve modern business problems. Offering on– site and offshore support and unique strategies, aNumak & Company transforms traditional business models into high–performance, dynamic, and distinctive business enterprises. It brings insights from core domain experts to deliver the best possible solutions to drive growth. aNumak & Company and each of its member firms are legally separate and independent entities. For more detailed information about aNumak & Company and its member companies, please visit https://www.anumak.com This material was prepared by aNumak & Company. This material (including any information it contains) is intended to provide general information on a particular topic(s). This material may contain information obtained from publicly available information or other third–party sources. aNumak & Company does not independently verify such sources and is not responsible for any loss resulting from reliance on information obtained from such sources. aNumak & Company does not provide any investment, legal, or other professional advice or services through this material. You should seek specific advice from the relevant specialist(s) for such services. This material or information is not intended to be considered the sole basis for any decision that could affect you, your business, or the operations of the company. Before making any decision or taking any action that could affect your finances or business, you should consult a professional. No institution at aNumak & Company can be held responsible for any loss suffered by any person or institution due to access to, use, or reliance on this material. By using this material or any information it contains, the user accepts he entirety of this notice and the terms of use. ©2022 aNumak & Company anumak.ai
  • 6. Amith Kumar Chief Executive Officer, aNumak & Company amith@anumak.com Neha Anush Chief Operating Officer, aNumak & Company neha.anush@anumak.com Tuǧçe ARSLAN Chief Content Officer and PR aNumak & Company arslan@anumak.in Cesibel Rodriguez Chief Branding Officer, aNumak & Company cesi@anumak.com Ricky Devaya Chief Human Resource Officer – India, aNumak & Company ricky@anumak.com Vilas Khole Chief Delivery Officer – India, aNumak & Company vilas@anumak.com Karthik Reddy Chief Sales Officer – UAE, aNumak & Company karthik@anumak.in Iván Muñiz Rothgiesser Sales Director, aNumak & Company ivan@anumak.com Gino Mori Valenzuela Client Partner – Retail, aNumak & Company gino@anumak.in Diana Marcela Rios Client Partner – Retail, aNumak & Company diana@anumak.in aNumak & Company marketing@anumak.com Pr@anumak.in - info@anumak.com Víctor Freundt Client Partner – Education, aNumak & Company victor@anumak.in Agyemang Mensah Kwadwo Graphic Designer, aNumak & Company agyemang@anumak.in anumak.ai CONTACTS CONTRIBUTORS