INTRODUCTION TO JAVA • Java is a most popular, object-oriented, widely used programming language and platform that is utilized for Android development, web development, artificial intelligence, cloud applications, and much more. So, mastering this gives you great opportunities in bigger organizations. • Java was originally developed by James Gosling at Sun Microsystems. It was released in May 1995 as a core component of Sun Microsystems' Java platform
FIRST PROGRAM OF JAVA // A Java program to print "Hello World" public class KESHAV { public static void main(String args[]) { System.out.println("Hello World"); } } Output : Hello World
FEATURES OF JAVA
• 1) SIMPLE: Java is simple to learn the concept of object oriented programming. • 2)Object Oriented:This reason makes java popular among developers. Oop includes concepts of object and classes and many more.
JAVA USES • GUI applications • Web servers and applications servers • Middleware applications • Web applications • Mobile applications • Embedded systems • Enterprise applications • It is used for developing Android Apps • Helps you to create Enterprise Software • Wide range of Mobile java Applications • Scientific Computing Applications • Use for Big Data Analytics • Java Programming of Hardware devices • Used for Server-Side Technologies like Apache, JBoss, GlassFish, etc.
COMPONENTS OF JAVA • 1 ) JAVA DEVELOPMENT KIT ( JDK ) • 2) JAVA VIRTUAL MACHINE ( JVM ) • 3) JAVA RUNTIME ENVIRONMENT ( JRE )
OPERATORS IN JAVA 1.Arithmetic Operators : 2.Unary Operators : 3.Assignment Operator : 4.Relational Operators 5.Logical Operators 6.Ternary Operator 7.Bitwise Operators 8.Shift Operators
• What are Strings in Java? • Strings are the type of objects that can store the character of values. A string acts the same as an array of characters in Java.
ARRAYS IN JAVA • Array in java is a group of like-typed variables referred to by a common name. Arrays in Java work differently than they do in C/C++. Following are some important points about Java arrays. • In Java, all arrays are dynamically allocated. (discussed below) • Arrays are stored in contiguous memory [consecutive memory locations]. • Since arrays are objects in Java, we can find their length using the object property length. This is different from C/C++, where we find length using sizeof. • A Java array variable can also be declared like other variables with [] after the data type. • The variables in the array are ordered, and each has an index beginning with 0. • Java array can also be used as a static field, a local variable, or a method parameter. • The size of an array must be specified by int or short value and not long. • The direct superclass of an array type is Object. • Every array type implements the interfaces Cloneable and java.io.Serializable. • This storage of arrays helps us randomly access the elements of an array [Support Random Access]. • The size of the array cannot be altered(once initialized). However, an array reference can be made to point to another array. The general form of a one-dimensional array declaration is type var-name[]; OR type[] var-name;
KEYWORDS IN JAVA • 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.
JAVA CLASSES • Java Classes • A class in Java is a set of objects which shares common characteristics/ behavior and common properties/ attributes. It is a user-defined blueprint or prototype from which objects are created. For example, Student is a class while a particular student named Ravi is an object. • Properties of Java Classes 1. Class is not a real-world entity. It is just a template or blueprint or prototype from which objects are created. 2. Class does not occupy memory. 3. Class is a group of variables of different data types and a group of methods. 4. A Class in Java can contain: 1. Data member 2. Method 3. Constructor 4. Nested Class 5. Interface
Types of Access Modifiers in Java There are four types of access modifiers available in Java: 1.Default – No keyword required 2.Private 3.Protected 4.Public
1. Default Access Modifier When no access modifier is specified for a class, method, or data member – It is said to be having the default access modifier by default. The data members, classes, or methods that are not declared using any access modifiers i.e. having default access modifiers are accessible only within the same package. 2. Private Access Modifier The private access modifier is specified using the keyword private. The methods or data members declared as private are accessible only within the class in which they are declared. •Any other class of the same package will not be able to access these members. •Top-level classes or interfaces can not be declared as private because • private means “only visible within the enclosing class”. • protected means “only visible within the enclosing class and any subclasses 3. Protected Access Modifier The protected access modifier is specified using the keyword protected. The methods or data members declared as protected are accessible within the same package or subclasses in different packages
Constructors in Java are used to initialize the values of the attributes of the object serving the goal to bring Java closer to the real world. We already have a default constructor that is called automatically if no constructor is found in the code. But if we make any constructor say parameterized constructor in order to initialize some attributes then it must write down the default constructor because it now will be no more automatically called. Multiple Inheritance is a feature of an object-oriented concept, where a class can inherit properties of more than one parent class. The problem occurs when there exist methods with the same signature in both the superclasses and subclass. On calling the method, the compiler cannot determine which class method to be called and even on calling which class method gets the priority. Note: Java doesn’t support Multiple Inheritance
What is Polymorphism in Java? Polymorphism is considered one of the important features of Object-Oriented Programming. Polymorphism allows us to perform a single action in different ways. In other words, polymorphism allows you to define one interface and have multiple implementations. The word “poly” means many and “morphs” means forms, So it means many forms. Types of Java polymorphism In Java polymorphism is mainly divided into two types: •Compile-time Polymorphism •Runtime Polymorphism Compile-Time Polymorphism It is also known as static polymorphism. This type of polymorphism is achieved by function overloading or operator overloading. Note: But Java doesn’t support the Operator Overloading.
Encapsulation in Java Encapsulation is a fundamental concept in object-oriented programming (OOP) that refers to the bundling of data and methods that operate on that data within a single unit, which is called a class in Java. Encapsulation is a way of hiding the implementation details of a class from outside access and only exposing a public interface that can be used to interact with the class. In Java, encapsulation is achieved by declaring the instance variables of a class as private, which means they can only be accessed within the class. To allow outside access to the instance variables, public methods called getters and setters are defined, which are used to retrieve and modify the values of the instance variables, respectively. By using getters and setters, the class can enforce its own data validation rules and ensure that its internal state remains consistent.
DATA ABSTRACTION • Data Abstraction may also be defined as the process of identifying only the required characteristics of an object ignoring the irrelevant details. The properties and behaviors of an object differentiate it from other objects of similar type and also help in classifying/grouping the objects. • An abstract class is a class that is declared with an abstract keyword. • An abstract method is a method that is declared without implementation. • An abstract class may or may not have all abstract methods. Some of them can be concrete methods
• • THANK YOU

Presentation2.ppt java basic core ppt .

  • 2.
    INTRODUCTION TO JAVA •Java is a most popular, object-oriented, widely used programming language and platform that is utilized for Android development, web development, artificial intelligence, cloud applications, and much more. So, mastering this gives you great opportunities in bigger organizations. • Java was originally developed by James Gosling at Sun Microsystems. It was released in May 1995 as a core component of Sun Microsystems' Java platform
  • 3.
    FIRST PROGRAM OFJAVA // A Java program to print "Hello World" public class KESHAV { public static void main(String args[]) { System.out.println("Hello World"); } } Output : Hello World
  • 4.
  • 6.
    • 1) SIMPLE:Java is simple to learn the concept of object oriented programming. • 2)Object Oriented:This reason makes java popular among developers. Oop includes concepts of object and classes and many more.
  • 7.
    JAVA USES • GUIapplications • Web servers and applications servers • Middleware applications • Web applications • Mobile applications • Embedded systems • Enterprise applications • It is used for developing Android Apps • Helps you to create Enterprise Software • Wide range of Mobile java Applications • Scientific Computing Applications • Use for Big Data Analytics • Java Programming of Hardware devices • Used for Server-Side Technologies like Apache, JBoss, GlassFish, etc.
  • 8.
    COMPONENTS OF JAVA •1 ) JAVA DEVELOPMENT KIT ( JDK ) • 2) JAVA VIRTUAL MACHINE ( JVM ) • 3) JAVA RUNTIME ENVIRONMENT ( JRE )
  • 9.
    OPERATORS IN JAVA 1.ArithmeticOperators : 2.Unary Operators : 3.Assignment Operator : 4.Relational Operators 5.Logical Operators 6.Ternary Operator 7.Bitwise Operators 8.Shift Operators
  • 11.
    • What areStrings in Java? • Strings are the type of objects that can store the character of values. A string acts the same as an array of characters in Java.
  • 12.
    ARRAYS IN JAVA •Array in java is a group of like-typed variables referred to by a common name. Arrays in Java work differently than they do in C/C++. Following are some important points about Java arrays. • In Java, all arrays are dynamically allocated. (discussed below) • Arrays are stored in contiguous memory [consecutive memory locations]. • Since arrays are objects in Java, we can find their length using the object property length. This is different from C/C++, where we find length using sizeof. • A Java array variable can also be declared like other variables with [] after the data type. • The variables in the array are ordered, and each has an index beginning with 0. • Java array can also be used as a static field, a local variable, or a method parameter. • The size of an array must be specified by int or short value and not long. • The direct superclass of an array type is Object. • Every array type implements the interfaces Cloneable and java.io.Serializable. • This storage of arrays helps us randomly access the elements of an array [Support Random Access]. • The size of the array cannot be altered(once initialized). However, an array reference can be made to point to another array. The general form of a one-dimensional array declaration is type var-name[]; OR type[] var-name;
  • 13.
    KEYWORDS IN JAVA •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.
  • 14.
    JAVA CLASSES • JavaClasses • A class in Java is a set of objects which shares common characteristics/ behavior and common properties/ attributes. It is a user-defined blueprint or prototype from which objects are created. For example, Student is a class while a particular student named Ravi is an object. • Properties of Java Classes 1. Class is not a real-world entity. It is just a template or blueprint or prototype from which objects are created. 2. Class does not occupy memory. 3. Class is a group of variables of different data types and a group of methods. 4. A Class in Java can contain: 1. Data member 2. Method 3. Constructor 4. Nested Class 5. Interface
  • 15.
    Types of AccessModifiers in Java There are four types of access modifiers available in Java: 1.Default – No keyword required 2.Private 3.Protected 4.Public
  • 16.
    1. Default AccessModifier When no access modifier is specified for a class, method, or data member – It is said to be having the default access modifier by default. The data members, classes, or methods that are not declared using any access modifiers i.e. having default access modifiers are accessible only within the same package. 2. Private Access Modifier The private access modifier is specified using the keyword private. The methods or data members declared as private are accessible only within the class in which they are declared. •Any other class of the same package will not be able to access these members. •Top-level classes or interfaces can not be declared as private because • private means “only visible within the enclosing class”. • protected means “only visible within the enclosing class and any subclasses 3. Protected Access Modifier The protected access modifier is specified using the keyword protected. The methods or data members declared as protected are accessible within the same package or subclasses in different packages
  • 18.
    Constructors in Javaare used to initialize the values of the attributes of the object serving the goal to bring Java closer to the real world. We already have a default constructor that is called automatically if no constructor is found in the code. But if we make any constructor say parameterized constructor in order to initialize some attributes then it must write down the default constructor because it now will be no more automatically called. Multiple Inheritance is a feature of an object-oriented concept, where a class can inherit properties of more than one parent class. The problem occurs when there exist methods with the same signature in both the superclasses and subclass. On calling the method, the compiler cannot determine which class method to be called and even on calling which class method gets the priority. Note: Java doesn’t support Multiple Inheritance
  • 19.
    What is Polymorphismin Java? Polymorphism is considered one of the important features of Object-Oriented Programming. Polymorphism allows us to perform a single action in different ways. In other words, polymorphism allows you to define one interface and have multiple implementations. The word “poly” means many and “morphs” means forms, So it means many forms. Types of Java polymorphism In Java polymorphism is mainly divided into two types: •Compile-time Polymorphism •Runtime Polymorphism Compile-Time Polymorphism It is also known as static polymorphism. This type of polymorphism is achieved by function overloading or operator overloading. Note: But Java doesn’t support the Operator Overloading.
  • 20.
    Encapsulation in Java Encapsulationis a fundamental concept in object-oriented programming (OOP) that refers to the bundling of data and methods that operate on that data within a single unit, which is called a class in Java. Encapsulation is a way of hiding the implementation details of a class from outside access and only exposing a public interface that can be used to interact with the class. In Java, encapsulation is achieved by declaring the instance variables of a class as private, which means they can only be accessed within the class. To allow outside access to the instance variables, public methods called getters and setters are defined, which are used to retrieve and modify the values of the instance variables, respectively. By using getters and setters, the class can enforce its own data validation rules and ensure that its internal state remains consistent.
  • 21.
    DATA ABSTRACTION • DataAbstraction may also be defined as the process of identifying only the required characteristics of an object ignoring the irrelevant details. The properties and behaviors of an object differentiate it from other objects of similar type and also help in classifying/grouping the objects. • An abstract class is a class that is declared with an abstract keyword. • An abstract method is a method that is declared without implementation. • An abstract class may or may not have all abstract methods. Some of them can be concrete methods
  • 22.