Android Attack! “Java on Java”


I set on this venue with zero to no Java experience, but with some C# experience. Which share some similarities and major differences. But the time has come for me to advance into the world of Java and Eclipse. So I’ll be breaking down my Java into a few different parts. (How many? No idea :D)

I’ll start with a basic Java code:

	
public class  {
    public static void main(String[] args) {

        String testMessage = "This is a test";
	String mySecondMessage = " demo"

	System.out.println("This is another test!");
	System.out.println(testMessage+mySecondMessage);

	int firstNumber = 55;
	int secondNumber = 10;

	int result = firstnumber + secondNumber;
	System.out.println(result);

	double myValue = 1234.3455;
	System.out.println(myValue);

	double mySecondValue = 9876.545;
	System.out.println(mySecondValue);
   }
}

This code will store it’s respected variable (tesMessage, mySecondMessage, firstNumber, secondNumber, myValue, and mySecondValue) and print them out.

With the output being:
This is another test!
This is a test demo
65
1234.3455
9876.545


String, int, and double are just some of the data types available in Java. A string is a sequence of characters: “Hi Buddy” (quotes must be used, whether double or single quote doesn’t matter.) An int is the default data type for integral values: 23, 344, 354423, and etc. Double is the main data type for decimal values: 23.45, 35.89, 2456453.24, and etc.

Variable naming convention in Java is to have the starting word to be lowercase and the subsequent first letter of each word should be uppercased; helloWorld.

Later on I will continue with classes and inheritances!

Go high five someone! – Randy

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s