ADVENTURE ISLAND AT GOOGLE AS SANKALP SE SIDDHI BHARAT.

ADVENTURE ISLAND AT GOOGLE AS SANKALP SE SIDDHI BHARAT.
DR. PRERNA SAXENA IT WOMEN SCIENTIST AT GOOGLE

Thursday, December 4, 2025

SUN JAVA BASICS

The term "Sun Java Basics" refers to the fundamental concepts of the Java programming language, as it was originally developed by Sun Microsystems (before being acquired by Oracle).

Here is an overview of the core concepts that define Java's foundation:

📜 Core Principles and Structure

1. The Java Platform

The Java platform is what makes Java applications highly portable ("Write Once, Run Anywhere").

  • Java Virtual Machine (JVM): The abstract machine that executes Java bytecode. It's the interpreter layer that translates bytecode into the native machine code of the underlying OS (Windows, macOS, Linux).

  • Java Runtime Environment (JRE): The minimal software required to run a Java application. It includes the JVM, core classes, and supporting files.

  • Java Development Kit (JDK): The full set of tools for developing Java applications. It includes the JRE, the compiler (javac), and other debugging/utility tools.

2. Execution Flow

  1. You write source code in a .java file.

  2. The Compiler (javac) converts the source code into bytecode in a .class file.

  3. The JVM executes the bytecode.

  4. Shutterstock
    Explore

💡 Syntax and Language Fundamentals

1. Basic Structure

All executable Java code must be contained within a class. Execution begins in the main method.

Java
public class MyFirstProgram {
    public static void main(String[] args) {
        // Output statement
        System.out.println("Hello from Java!"); 
    }
}

2. Data Types

Java has two main categories of data types:

CategoryTypeDescriptionExample
Primitiveint, long, float, doubleNumeric values (integers and decimals).int count = 10;
charA single Unicode character.char initial = 'S';
booleanRepresents true or false.boolean isComplete = true;
Non-PrimitiveString, Arrays, ClassesReference types that hold memory addresses.String name = "Sun";

3. Variables

Variables must be declared with their type before they can be used.

  • Declaration: int speed;

  • Initialization: speed = 60; or combined: int speed = 60;

  • Constants: Defined using the final keyword (e.g., final double PI = 3.14159;).

4. Operators

  • Arithmetic: +, -, *, /, % (modulo/remainder).

  • Relational: ==, !=, >, <, >=, <=.

  • Logical: && (AND), || (OR), ! (NOT).


🔁 Control Flow

These constructs determine the order in which statements are executed.

1. Decision Making

  • if-else: Executes a block if a condition is true.

    Java
    if (score >= 90) {
        System.out.println("Grade A");
    } else {
        System.out.println("Not an A");
    }
    
  • switch: Executes one block of code among many alternatives based on a single value.

2. Looping

  • for loop: Used when you know the number of iterations beforehand.

    Java
    for (int i = 0; i < 5; i++) {
        System.out.println(i); // Prints 0 to 4
    }
    
  • while loop: Repeats a block of code as long as a condition is true.

  • do-while loop: Executes the loop body at least once, then checks the condition.


⚙️ Object-Oriented Programming (OOP)

Java is an OOP language, built around the concept of objects and classes.

  • Class: A blueprint for an object. It defines the structure (data/variables) and behavior (methods/functions) of its objects.

  • Object: An instance of a class. When you create an object, memory is allocated for it.

The four pillars of OOP are:

  1. Encapsulation: The mechanism of binding the data (variables) and the code acting on the data (methods) together into a single unit (the class), and protecting the data from outside interference.

  2. Inheritance: The process by which one class acquires the properties and methods of another class, promoting code reuse.

  3. Polymorphism: The ability of an object to take on many forms. This is achieved through method overriding (redefining an inherited method) and method overloading (methods with the same name but different parameters).

  4. Abstraction: Hiding complex implementation details and showing only essential information. This is achieved using abstract classes and interfaces.

Would you like to explore more about OOP concepts or see an example of control flow?

Sunday, November 30, 2025

Types of INHERITANCE CONCEPTS IN JAVA

 Types of Inheritance in Java

​Java only supports Single Inheritance through classes, meaning a class can only inherit from one direct parent class. However, it can achieve effects similar to other types through interfaces.

​Single Inheritance: A class inherits from only one superclass.

​Example: Class B extends Class A

​Multilevel Inheritance: A class inherits from a parent, and that parent also inherits from another class.

​Example: Class C extends Class B, and Class B extends Class A

​Hierarchical Inheritance: Multiple subclasses inherit from a single superclass.

​Example: Class B extends Class A, and Class C extends Class A

​🛑 Note: Multiple Inheritance (inheriting from two or more classes) is not supported in Java classes to avoid the "Diamond Problem." This concept is supported through Interfaces.

​Key Mechanisms Related to Inheritance

​1. super Keyword

​The super keyword is used inside a subclass to refer to the immediate superclass's members.

​Accessing a Superclass Field: super.fieldName

​Calling a Superclass Method: super.methodName()

​Calling a Superclass Constructor: super(arguments)

​This must be the first statement in the subclass constructor.

​2. Method Overriding

​This is the ability of a subclass to provide a specific implementation for a method that is already provided by its superclass.

​The method signature (name and parameter list) must be the same.

​The return type must be the same or a covariant return type (a subclass of the superclass's return type).

​The access modifier cannot be more restrictive than the superclass method.

​3. final Keyword

​The final keyword can be used to restrict inheritance:

​final class: A class declared as final cannot be inherited.

​final method: A method declared as final cannot be overridden in a subclass.

Wednesday, November 26, 2025

The story of colours and friendship.

 The Story of Colors and Friendship

Long, long ago, when Lord Krishna was a little boy, he was very sweet, but he worried about one thing: his skin was blue, but the skin of his friend, Radha, was fair and beautiful.

One day, little Krishna went to his mother, Yashoda, and complained, “Amma, everyone teases me because I am blue, and Radha is so lovely. Why are we so different?”

His mother, who loved him very much, smiled sweetly. “My dear Krishna, if you are so worried about the color, why don't you change it?”

Krishna looked puzzled. “Change it? How?”

His mother pointed to a shelf where she kept little pots of natural colors made from flowers and herbs—red for love, yellow for happiness, green for new beginnings.

“Go and take some of those colors, Krishna,” she said. “Go to Radha and color her face any way you like! Then she will look just like you.”

Krishna giggled! What a fun idea! He grabbed the colors and ran off to the town of Vrindavan where Radha lived.

When he found Radha, she was busy playing. He crept up to her and, with a splash of mischief, smeared yellow and pink powder on her cheeks!

Radha was shocked at first, but then she saw Krishna’s sparkling, playful eyes. She burst into laughter! She immediately grabbed her own handful of green powder and chased him, painting his blue skin with bright splashes of spring green.

Soon, their friends joined in, throwing water mixed with colors and laughing until their bellies ached. Every single person was covered head-to-toe in every color imaginable. No one was blue, no one was fair—everyone was red, yellow, pink, and green! They all looked the same, laughing together.

This wonderful game of coloring faces became a tradition. It taught everyone that the real color of life is the joy we share when we treat everyone equally and with love.

That is why we play Rangwali Holi (Holi with colors)! It’s a day to forget our differences, celebrate friendship, and cover everyone in the bright, happy colors of spring!