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

Lesson1 Java Python CheatSheet

This document is a cheat sheet comparing basic syntax between Java and Python, focusing on input/output, variables, and structure. It provides examples of a simple program in both languages, variable declarations, and methods for taking user input. The comparison highlights the differences in syntax and structure between the two programming languages.

Uploaded by

sopoy59260
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views2 pages

Lesson1 Java Python CheatSheet

This document is a cheat sheet comparing basic syntax between Java and Python, focusing on input/output, variables, and structure. It provides examples of a simple program in both languages, variable declarations, and methods for taking user input. The comparison highlights the differences in syntax and structure between the two programming languages.

Uploaded by

sopoy59260
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Java vs Python - Lesson 1: Basics Cheat

Sheet
This cheat sheet compares basic Java and Python syntax for input/output, variables, and
structure.

☕ Java Basics

public class HelloWorld {


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

➡ Variable Examples:

int age = 25;


double pi = 3.14;
char grade = 'A';
boolean pass = true;
String name = "Tarun";

➡ Taking input:

import java.util.Scanner;

Scanner scanner = new Scanner(System.in);


System.out.println("Enter your name:");
String name = scanner.nextLine();
System.out.println("Enter your number:");
int num = scanner.nextInt();
System.out.println("Hey " + name + ", your lucky number is " + num +
"!");
🐍 Python Basics

print("Hello, Tarun!")

➡ Variable Examples:

age = 25
pi = 3.14
grade = 'A'
pass_status = True
name = "Tarun"

➡ Taking input:

name = input("Enter your name: ")


num = input("Enter your favorite number: ")
print(f"Hey {name}, your lucky number is {num}!")

You might also like