Introduction to java
The aim of Java is to write programs that runs on variety of computer systems and computer controlled devices. This is often called as "Write once run anywhere". This Session explains Java's typical development environment.2
Your First Java Program
In this session we will write a simple Java program, understand memory concepts, use arithmetic operations, use input and output statements, etc.1
Fundamentals – Memory, Data and Data Types in Java
What is an Information?
- Information could be anything like – facts, details, particulars, statistics, figures, knowledge, etc.
- Information is everywhere. Our daily conversations, our expenses, shopping, budgeting, whether condition, traveling, etc. are all pieces of information.
- For example, consider the following:
- Today’s Temperature is 30.4 Degree Celcius.
- I Travel 50 km daily for my work.
- She is 6 feet tall.
- Yes, I love skydiving.
What is data?
- Whenever we store information inside a computer memory (Storage Unit), it becomes data.
- In the above example, 30.4 degrees Celcius, 50km, 6 feet, and Yes are all data.
What is a computer memory?
- A memory is nothing but large sequential storage boxes to store information. Simply, it is a storage box.
- When information is stored inside a computer’s memory, it will be called data.
- Hence, data is nothing but the information stored inside a computer’s storage unit, AKA computer memory.
- Memory has two components
- Storage units (boxes) to store data.
- Address to locate the storage units.
- Data can be classified into many types.
- The data types are,
- Integers (int)
- Floating point numbers (float, double)
- Boolean Values (boolean)
- Characters (char)
- The sequence of Characters (String)
- In our previous example,
- the data 30.4 degrees Celcius is a floating-point data type.
- 50 km and 6 feet are all integer data types.
- Yes is a boolean data type.
- Information we generate daily will fall only into the above-mentioned types.
- This is the reason we classify data accordingly and call them data types. (types of data)
- When using data in your programming it is mandatory that you must mention its type of data.
- This is logical as without mentioning the data type, how would the computer process those data?