0% found this document useful (0 votes)
2 views2 pages

Java Python Exam Notes

The document provides final exam notes for Java and Python, covering basics, variables and data types, input/output methods, conditional statements, and loops. It includes sample code snippets for both languages to illustrate each concept. Key differences in syntax between Java and Python are highlighted throughout the notes.

Uploaded by

mshaffanahmad
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)
2 views2 pages

Java Python Exam Notes

The document provides final exam notes for Java and Python, covering basics, variables and data types, input/output methods, conditional statements, and loops. It includes sample code snippets for both languages to illustrate each concept. Key differences in syntax between Java and Python are highlighted throughout the notes.

Uploaded by

mshaffanahmad
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/ 2

Final Exam Notes: Java and Python

Java Final Exam Notes


1. Java Basics

Structure of a basic Java program:

public class HelloWorld {


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

2. Variables and Data Types


int age = 20;
double salary = 35000.50;
char grade = 'A';
boolean isPassed = true;
String name = "Ali";

3. Scanner for Input


import java.util.Scanner;
Scanner input = new Scanner(System.in);
int age = input.nextInt();
String name = input.nextLine();

4. Conditional Statements
if (score >= 90)
System.out.println("Grade A");
else if (score >= 80)
System.out.println("Grade B");
else
System.out.println("Grade C");

5. Loops
for (int i = 0; i < 5; i++) {
System.out.println(i);
}
Python Final Exam Notes
1. Python Basics
print("Hello, World!")

2. Variables and Data Types


age = 20
salary = 35000.50
grade = 'A'
is_passed = True
name = "Ali"

3. Input/Output
name = input("Enter your name: ")
age = int(input("Enter your age: "))
print("Hello", name)

4. Conditional Statements
if score >= 90:
print("Grade A")
elif score >= 80:
print("Grade B")
else:
print("Grade C")

5. Loops
for i in range(5):
print(i)

You might also like