Copyright

Java Fields vs. Java Variables

Instructor: David Gloag

David has over 40 years of industry experience in software development and information technology and a bachelor of computer science

In this lesson, we'll take a look at the programming language Java and compare Jave variables and Java fields and discuss why you would use one over the other. At the end, you should have a good understanding of these important Java concepts.

Connection Magic

We live in a world where the Internet seems to dominate all, where the need to stay connected can be overwhelming. If you don't agree, just look at the people around you. Many are likely surfing the net, sending email, or texting with their friends. All of this in the name of making connections. But have you ever wondered what makes it all work? Some might say it's magic. For those that know, it is a vast array of computer-based technology coming together to solve a problem, the problem of connections. And one of those technologies is a language called Java.

What is Java?

Java is a computer programming language that dates back to 1991. It is a high-level language, meaning that every statement converts to a number of machine language statements. Originally called OAK, it was created by Sun Microsystems to perform an array of general purpose tasks. Initially, it was targeted for tablets, cell phones, and set-top boxes (television). When this didn't go anywhere, circa 1999, the language was adjusted to work with the Internet. In 2009, Oracle purchased it from Sun Microsystems along with some other technologies. Today, Java is preferred by millions of developers and exists on billions of devices.

Java Variables

A Java variable is a named block of memory that has a type and a corresponding size associated with it. For example, consider the following variable declaration:

int orange;

This declaration allocates a fixed amount of memory, assigns that memory the name 'orange', and tells us that 'orange' will be used to hold integer information. Further, Java variables can be used to manipulate information. For example:

orange = 5;
orange = orange + 1;

This will result in the variable 'orange' containing the integer value 6. Granted, this is a simple example. But you can easily see the power of this when you consider that many more operations are possible.

To unlock this lesson you must be a Study.com Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use Study.com

Become a Study.com member and start learning now.
Become a Member  Back
What teachers are saying about Study.com
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? Study.com has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account
Support