Skip to main content

Let's Java (Android App Development)

Let's do a quick rehash of what you must remember about the basic syntax of Java.

Android App Development

Firstly, Java is case sensitive. To a computer, t is not T.
If the variable you cent (TreeCount) is really named treeCount, the program won't work.

// These are completely different variables !

int treeCount = 15;
int TreeCount = 25;

This can frustate a human, by the computer doesn't care so watch out.

For all class Names, the first letter should be in uppercase .

If several words are used to form the name of the class, then each word's first letter should be in uppercase.
For examples, we can have a Tree class :
public class Tree{
// Tree class
public void showMsg (){
System.out.println ("Tree Here");
}
}
You can create an instance of this class.

Remember that Variables are typically lowercase, while classes are uppercase.

Therefore, using the same name for Both class and instance variables actually helps us differentiate.

public static void main (String[] args) {
Tree tree = new Tree();
tree showMsg ();
}
All Method Names should start with a lowercase letter.

If several words are used to form the name of the method, then each words after, the first word should have the first letter as uppercase.

For example, the following method takes in a variable and does not some math.

public int addTwoNumbers (int firstNumber, int secondNumber){
int sum = firstNumber + secondNumber;
return sum;
}
The program Files Name should exactly match the class name. When saving the files, you should save it using the class name.

public int add2Numbers (int firstNumber, int secondNumber)
{int sum = firstNumber + secondNumber;
return sum;}
getclass(  )
can be used to find out what class the method belongs to.

The file can be saved as file as Number.java (.java is the file extension and Number is the name of the class used).

Comments

Post a Comment

Popular posts from this blog

Let us understand DevOps

What Will You Learn ? DevOps is a set of practices that combines software development (Dev) and IT operations (Ops) This article will get you started with the fundamentals of DevOps and understanding how to use it in real projects Understanding what DevOps is and why it's needed along with the basic terminologies Getting started with DevOps and understanding its architecture and lifecycle Introduction to Git and it's basic commands Introduction to Docker, Docker container and it's related concepts Getting started with Jenkins and understanding how to integrate it with Github Basics of Selenium and Nagios Who is the target audience ? Students and industry professionals who wish to get hands-on something called DevOps Users who wish to learn how to integrate the processes between software development IT teams and manage various projects Benefits Improved operational support and faster fixes Good processes across IT and teams, including automation Increased team flexibility an...

What is Hard Disk? Definition, functions and types.

In this article, you will know what is Hard Disk and what are these types? Hard disks are also often called Disk drive or "Hard Disk Drive (HDD)". Just as a library is required to handle books in the library, the same computer also needs a similar place in which it can store digital data .  Computers use two types of storage devices to store and process digital content (Document, Image, Videos, Software, Operating system, Program). In which Hard Disk is a secondary memory device. It keeps the data stored permanently. Whereas the primary memory device (RAM) serves to process the program of the computer . It is also called temporary memory. Hard Disk is seen as an important component of a computer because no computer will work without it. In this post we will tell you what is a hard disk in a computer ? In which you will get to know a lot about Hard Disk. So let's first know, what is called a hard disk and then we will talk about other aspects of it. What is hard disk ...

Artificial Intelligence

Artificial Intelligence When we prepare a computer in such a way that it can act like a human's intelligence, it is called artificial intelligence says that when we set a program in a machine that it can work like human so where does he go to artificial intelligence . To understand AI it is necessary to understand these 6 words Visual Perception Speech Recognition Decision Making Language Translation Knowledge Reasoning Ability According to John Macatha's father of Artificial Intelligence, It is the science and engineering of making intelligent machines especially intelligent computer programs.  Artificial Intelligence is a way to build a computer, a computer-controlled robot, or a software intelligence. Things, just as intelligent people think. A.I is studied by the fact that humans how the brain thinks, and how humans learn, decide, and try to solve a problem work, and then the results of this study based on developing intelligent software and system use. The goal of Artific...