Lesson 1

Overview of java programming Language.

In this course we are going to look at android development with the java programming language.

A Java program is a collection of objects that communicate with one another by making method calls. Here is a quick rundown of Java’s Classes and Objects, Methods, Instance Variables, Syntax, and Semantics.

Java’s fundamental terminologies

  1. Class: A class is a blueprint (plan) for a class instance (object). It is a template that describes the data and behavior associated with a specific instance.

The blueprint of the house is an example of class.

  1. Object: An object is a class instance. It is a thing with behavior and a state.

A car, for example, has three states: brand, color, and license plate.
Running on the road is a bad habit.

  1. Method: The method is an object’s behavior.

Example: The gas indicates the amount of cooking fuel left in the bottle.

4.Instance variables: Each object has its own set of instance variables that are unique to it. The values assigned to these instance variables generally create the state of an object.

if you don’t have a java compiler already installed please go to https://www.programiz.com

Or head on now to download the free IDE recommended for the course (Integrated Development Environment) from https://www.JetBrains.com

Running Our First Java “Hello World Program”


public class HELLO {
    public static void main(String[] args)
    {
        System.out.println("Hello World");
    }
}
Output: Hello World

When the class is made public, the name of the file must match the name of the class.

Syntax:

In Java, there are three types of comments.

 i. Single line Comment

// System.out.println("HELLO");

ii. Multi-line Comment

/*
    System.out.println("Allison!");
    System.out.println("Alicia!");
*/

iii. Documentation Comment. Also called a doc comment.

/** documentation */

2. Source File Name

The name of a source file should exactly match the name of the public class, with the extension.java. If there are no public classes in the file, the name can be changed. Assume you have a public HELLO class.

HELLO.java // valid syntax
hello.java // invalid syntax
  1. Sensitivity to Cases

Because Java is a case-sensitive language, the identifiers AB, Ab, aB, and ab differ in Java.

4. Classification

i. The first letter of the class should be capitalized (lowercase is allowed, but discouraged).

ii. If several words are used to form the class name, the first letter of each inner word should be in uppercase. Underscores are permitted but not encouraged. Numbers and currency symbols are also permitted, though the latter are discouraged because they serve a specific purpose (for inner and anonymous classes). 
class MyJavaProgram    // valid syntax
class 1Program         // invalid syntax
class My1Program       // valid syntax
class $Program         // valid syntax, but discouraged
class My$Program       // valid syntax, but discouraged (inner class Program inside the class My)
class myJavaProgram    // valid syntax, but discouraged.
5. static public void main (String [] args)

The main() method is the primary entry point into a Java program; it is where the processing begins. The signature public static void main(String... args) is also permitted.

6. Method Titles

i. All method names must begin with a lowercase letter.

ii. If several words are used to form the method's name, the first letter of each inner word should be capitalized. Underscores are permitted but not encouraged. Digits and currency symbols are also permitted.
public void medicalRecords() // valid syntax
public void MedicalRecords() // valid syntax, but discouraged
7. Java identifiers

Identifiers include the names of local variables, instance and class variables, labels, and classes, packages, modules, and methods. All Unicode characters, not just the ASCII subset, are valid.

i. Identifiers can all start with a letter, a currency symbol, or an underscore ( ). For variables, a letter should be in lower case, according to convention.

ii. The first character of an identifier can be any combination of letters, digits, currency symbols, and underscores. The underscore is not recommended for variable names. Constants (static final attributes and enums) should be written entirely in capital letters.

iii. Finally, identifiers are case-sensitive.

iv. Because a keyword is a reserved word, it cannot be used as an identifier.
8. Java Keywords

Keywords or Reserved words are the words in a language that are used for some internal process or represent some predefined actions. These words are therefore not allowed to use as variable names or objects. 

abstract 	assert 	boolean 	break  byte 	case 	catch 	char do 	double 	else 	enum

class 	const 	continue 	default extends 	final 	finally 	float  for 	goto 	if 	implements

import 	instanceof 	int 	interface  long 	native 	new 	package  short 	static 	strictfp 	super

private 	protected 	public 	return  throws 	transient 	try 	void

switch 	synchronized 	this 	throw.

Free Digital Marketing Course.

Includes Branding,SEO Concepts.