<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://ideawaza.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=70.114.155.220</id>
	<title>IdeaWazaWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://ideawaza.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=70.114.155.220"/>
	<link rel="alternate" type="text/html" href="https://ideawaza.com/wiki/Special:Contributions/70.114.155.220"/>
	<updated>2026-09-29T20:01:37Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://ideawaza.com/index.php?title=Basic_Java_Language&amp;diff=36696</id>
		<title>Basic Java Language</title>
		<link rel="alternate" type="text/html" href="https://ideawaza.com/index.php?title=Basic_Java_Language&amp;diff=36696"/>
		<updated>2006-09-30T02:33:20Z</updated>

		<summary type="html">&lt;p&gt;70.114.155.220: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This lesson discusses the basics of the Java language, including variables, primitives, operators, statements and Java writing conventions.&lt;br /&gt;
==Variables==&lt;br /&gt;
Variables are used to store data that can change. There are two main categories of variables, &#039;&#039;reference variables&#039;&#039; and &#039;&#039;primitive variables&#039;&#039;. Reference variables are place holders for objects (More on objects in Lesson 4, [[Java Objects and Classes]].) Primitive variables are given a value of a primitive, a basic value. Variables are all given a type when they are declared, such as &amp;quot;int&amp;quot; or &amp;quot;string&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Primitive Data Types==&lt;br /&gt;
Primitives are the simplest type of data. Primitives consist of numbers, letters and strings of letters. The following table shows all the types of primitives.&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5&lt;br /&gt;
| &#039;&#039;&#039;Primitive&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Values&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| A brief, 8-bit integer&lt;br /&gt;
| Whole numbers -128 through 127&lt;br /&gt;
|-&lt;br /&gt;
| short&lt;br /&gt;
| A short, 16-bit integer&lt;br /&gt;
| Whole numbers -32,768 through 32,767&lt;br /&gt;
|-&lt;br /&gt;
| int&lt;br /&gt;
| A 32 bit integer&lt;br /&gt;
| Whole numbers -2,147,483,648 through 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| A long, 64 bit integer&lt;br /&gt;
| Whole numbers -9,223,372,036,854,775,808 through 9,223,372,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| Single-percision floating poing (32-bit IEEE 754)&lt;br /&gt;
| Smallest positive non-zero: 14e&amp;lt;sup&amp;gt;-45&amp;lt;/sup&amp;gt;, Largest positive non-zero: 3.4028234e&amp;lt;sup&amp;gt;38&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| Double-percision floating point (64-bit IEEE 754)&lt;br /&gt;
| Smallest positive non-zero: 4.9e&amp;lt;sup&amp;gt;-324&amp;lt;/sup&amp;gt;, Largest positive non-zero: 1.797693157e&amp;lt;sup&amp;gt;308&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| A single character&lt;br /&gt;
| All Unicode characters&lt;br /&gt;
|-&lt;br /&gt;
| boolean&lt;br /&gt;
| A Boolean value&lt;br /&gt;
| &#039;&#039;&#039;true&#039;&#039;&#039; or &#039;&#039;&#039;false&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Declaring Variables==&lt;br /&gt;
In a nutshell, declaring a variable has this syntax:&lt;br /&gt;
&amp;lt;pre&amp;gt; [variable type] [identifier];&amp;lt;/pre&amp;gt;&lt;br /&gt;
This works for both reference variables and primitive variables. [variable type] is the type of variable, like &#039;&#039;&#039;int&#039;&#039;&#039; or &#039;&#039;&#039;char&#039;&#039;&#039;. [identifier] is the name for the variable you wish to create, for example, &#039;&#039;password&#039;&#039; or &#039;&#039;number_of_fish&#039;&#039;. If you wanted to create a &#039;&#039;&#039;int&#039;&#039;&#039; variable called &#039;&#039;age&#039;&#039;, you would type this:&lt;br /&gt;
&amp;lt;pre&amp;gt;int age;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Notice the semicolon at the end of the statement. All statements in Java must end in this, otherwise you will get a compiler error. &lt;br /&gt;
&lt;br /&gt;
You can set the values of variables while declaring them, like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;int age = 100;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can declare multiple variables on one line, if you wish:&lt;br /&gt;
&amp;lt;pre&amp;gt; boolean a, b;&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Identifiers===&lt;br /&gt;
There are several rules for the naming of your variables. Identifiers can be named using all the letters from A through Z (capital or lowercase, you choose), numbers 0-9 and underscore _ and the dollar sign $. The first character of the identifier cannot be a number, but it can be a letter, _ or $. &lt;br /&gt;
&lt;br /&gt;
You can&#039;t create two variables with the same identifier, all identifiers must be unique. You also can&#039;t use an identifier that is a Java keyword. Here is a list of all the [http://en.wikipedia.org/wiki/Java_keywords Java Keywords]&lt;br /&gt;
==Statements==&lt;br /&gt;
A statement in Java is generally a line of code that does something. Statements are ended by a semicolon ;. An example of a statement is the declaration of a variable like we saw before. Another example you will recall from the &amp;quot;Hello World&amp;quot; program we made in Lesson 1. &lt;br /&gt;
&amp;lt;pre&amp;gt;System.out.println(&amp;quot;Hello World&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
This line of code prints &#039;&#039;Hello World&#039;&#039; onto the console.&lt;br /&gt;
==Comments==&lt;br /&gt;
Comments are notes that the developer can insert into their code. This allows the developer to keep track of their code and helps when developers are collaborating on a project. It is good to write a summary of the following code at the beginning of your methods, classes, etc. The Java compiler completely ignores comments, so you can say anythiing in them&lt;br /&gt;
&lt;br /&gt;
Comments are written using two forward slashes&lt;br /&gt;
&amp;lt;pre&amp;gt;//This is a comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
Comments can be written at the end of a line&lt;br /&gt;
&amp;lt;pre&amp;gt;System.out.println(&amp;quot;I love comments&amp;quot;); //This is also a comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
Comments can also be written on multiple lines by starting with &#039;&#039;&#039;/*&#039;&#039;&#039; and ending with&#039;&#039;&#039;*/&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;/* Comment 1&lt;br /&gt;
Comment 2&lt;br /&gt;
Comment 3 */&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Operators==&lt;br /&gt;
===Equality Operator = ===&lt;br /&gt;
The equality operator sets the variable on its left equal to the value on its right. This code creates the variable &#039;&#039;a&#039;&#039; and sets it equal to 5&lt;br /&gt;
&amp;lt;pre&amp;gt;int a;&lt;br /&gt;
a = 5;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Fairly simple, right? Here is where it can get a little more tricky. &lt;br /&gt;
&amp;lt;pre&amp;gt;int a;&lt;br /&gt;
int b;&lt;br /&gt;
b = 6;&lt;br /&gt;
a = b;&amp;lt;/pre&amp;gt;&lt;br /&gt;
At first glance, you might think that the last statement is setting &#039;&#039;a&#039;&#039; equal to the letter &amp;quot;b&amp;quot;, but instead it is setting &#039;&#039;a&#039;&#039; equal to the &#039;&#039;value&#039;&#039; of &#039;&#039;b&#039;&#039;, which is 6.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;More comming soon&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Topic:Java|Back to Java Main Page]&lt;/div&gt;</summary>
		<author><name>70.114.155.220</name></author>
	</entry>
</feed>