0% found this document useful (0 votes)
4 views5 pages

Java Python Mastery

The document provides comprehensive guides for both Java and Python programming languages, covering essential topics such as variables, data types, control flow, loops, methods, object-oriented programming, exception handling, collections, and file handling. Each section includes code examples to illustrate the concepts. The guides emphasize the high-level and dynamic nature of both languages, making them accessible for beginners.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Java Python Mastery

The document provides comprehensive guides for both Java and Python programming languages, covering essential topics such as variables, data types, control flow, loops, methods, object-oriented programming, exception handling, collections, and file handling. Each section includes code examples to illustrate the concepts. The guides emphasize the high-level and dynamic nature of both languages, making them accessible for beginners.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Java Master Guide

📄 1. Introduction to Java

• Java is a high-level, object-oriented, platform-independent programming language.


• WORA: Write Once, Run Anywhere (due to JVM).

🔹 Example:

public class HelloWorld {


public static void main(String[] args) {
System.out.println("Hello, Rohith Ji!");
}
}

📄 2. Variables & Data Types

• int, float, char, double, boolean, String

int age = 21;


String name = "Rohith";
boolean isKing = true;

📄 3. Operators & Control Flow

• Arithmetic, Relational, Logical


• if-else, switch-case

if(age > 18) {


System.out.println("Adult");
} else {
System.out.println("Minor");
}

📄 4. Loops

• for, while, do-while

1
for(int i = 1; i <= 5; i++) {
System.out.println(i);
}

📄 5. Arrays & Strings

int[] arr = {1, 2, 3};


String str = "Rohith";
System.out.println(str.length());

📄 6. Methods

public static int add(int a, int b) {


return a + b;
}

📄 7. OOP Concepts

• Class, Object, Inheritance, Polymorphism, Encapsulation, Abstraction

class Animal {
void sound() {
System.out.println("Animal sound");
}
}
class Dog extends Animal {
void sound() {
System.out.println("Bark");
}
}

📄 8. Exception Handling

try {
int x = 10 / 0;
} catch(Exception e) {

2
System.out.println("Error: " + e);
}

📄 9. Collections

• ArrayList, HashMap

ArrayList<String> list = new ArrayList<>();


list.add("Java");
HashMap<String, Integer> map = new HashMap<>();
map.put("Rohith", 1);

📄 10. File Handling

FileWriter writer = new FileWriter("data.txt");


writer.write("Hello, Rohith!");
writer.close();

Python Master Guide

📄 1. Introduction to Python

• Python is an interpreted, dynamically typed, high-level language.

print("Hello, Rohith Ji")

📄 2. Variables & Data Types

age = 21
name = "Rohith"
is_king = True

3
📄 3. Operators & Control Flow

if age > 18:


print("Adult")
else:
print("Minor")

📄 4. Loops

for i in range(1, 6):


print(i)

📄 5. Lists, Tuples, Dictionaries

lst = [1, 2, 3]
tup = (4, 5)
d = {"name": "Rohith"}

📄 6. Functions

def add(a, b):


return a + b

📄 7. OOP in Python

class Animal:
def sound(self):
print("Animal sound")

class Dog(Animal):
def sound(self):
print("Bark")

4
📄 8. Exception Handling

try:
x = 10 / 0
except Exception as e:
print("Error:", e)

📄 9. File Handling

with open("data.txt", "w") as f:


f.write("Hello, Rohith!")

Let me know when you're ready to export both as PDFs! 💾

now

You might also like