Download presentation
Presentation is loading. Please wait.
1
FUNDAMENTALS OF JAVA
2
Compilation Unit The entire file or .java file is called Compilation Unit In Compilation Unit , we can have multiple classes. Every Java application has at least one class. At least one class has to be public.
3
Main() method There is a common signature in every Java program which is an entry point called main() method. This is where the Java program starts. This is called Starting point for a java class.
4
Class & Object Classes are the basis of objects.
Every java application has at least one class. In other words, a class can be defined as a template/blue print that describes the behaviors/states that object of its type support. Example of class: blueprint of building a car, a template or model of a building, floor.
5
Class & Object A class is can also be considered as a container which holds or stores within it self. An object can be defined as an instance of a class. Objects have states and behaviors. States are the properties or attributes in the world of Java. Behaviors are the methods or functions in the world of Java.
6
Class & Object Example : Object : Car State: color, make, model
Behavior: Drive Object :Human Beings State :name, address -- Properties/Attributes Behavior : Move, dance, work, run, shout -- Methods/Functions
7
Naming a class Name of the class is it has to start with _ (underscore), letter, $(dollar) sign . Always give some meaningful name which tells you about what your class is saying.
8
Access Modifiers public is accessed by any number of classes.
private is accessible within the class. protected is accessible within the class and all the classes within the packages.
9
More about Java Programming
Java is --Case Sensitive --Does not really care about white space. That means does not really requires indentation. --Statements always ends with semi-colon(;)
10
Comments Comments are notes or documents or keypoints about your program. Compiler ignores everything that is writen in between the slashes. Categorized as two types: Single line comments Eg: // displaying the output Multiple line comments Eg: /******************* These are my comments *********** */
11
Keywords Keywords are always constant and we can never change them.
public static void System For If …………etc
12
Java Data Types Java Data Types are of two types:
Primitive Data Types : System build datatypes which cannot be broken down. User Defined Types : Users define the data types.
13
Java Data Types Primitive Data Types are of 8 types: byte -- 8bits
short bits int – 32 bits long – 64bits float– 32 bits double – 64 bits char– 8bits boolean - 8 bits
14
Examples long ssn = L; float pi = F; int var = 123; char letter =‘a’; boolean one =true; double =1244.5;
15
Examples
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.