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 an NFT? (Non Fungible Token) NFT's explained

Guys, You must have heard the words NFT or Blockchain recently. That is, Jack Dorsey is selling his first tweet, a lot of people are selling digital art paintings. These are being sold through NFTs. Here, I'm talking about the NFT, not NEFT that is used in banking transactions. Because NFT has emerged as an important word in the realm of technology.  It is quite unique but still not many people know about this. So, let's dive deep into the NFT or the Non Fungible Tokens. And if you enjoy reading this article then do share it with others. You might feel odd to talk about NFT, but if you look at Blockchain implementation of which was Cryptocurrency or Bitcoin, just like that NFT is it's second implementation. And the profit of this implementation is you can sell unique, expensive, valuable, rare and one of a kind things.  What's the meaning of one of a kind? Its pretty simple, there's only one piece of a certain thing existing in the world. It means, the value of a ...

Unraveling the Mysteries of Quantum Computers: A Glimpse into the Future of Computing

In the realm of computer science, the concept of quantum computing stands as a beacon of unprecedented potential. Unlike classical computers that rely on bits to process information in binary form (0s and 1s), quantum computers harness the mind-bending principles of  quantum mechanics to manipulate quantum bits or qubits. This revolutionary approach holds the promise of solving complex problems at speeds that traditional computers could only dream of. Let's delve deeper into the enigmatic world of quantum computing. Understanding Quantum Computer: At the heart of quantum computing lies the qubit, the fundamental unit of quantum information. Qubits possess the unique ability to exist in multiple states simultaneously, thanks to a phenomenon called superposition. This allows quantum computers to perform parallel computations on a scale unimaginable with classical computers. Furthermore, quantum computers leverage another principle of quantum mechanics known as entanglement. Entangle...