Java Programming - Day 2 Notes
1. main() method - Program yahan se start hota hai
public static void main(String[] args) {
// Code yahan likhtay hain
Ye method Java ko batata hai ke program yahan se run hoga.
2. System.out.println() - Print line on screen
System.out.println("Hello Java!");
println ka matlab: print + new line
System.out.print("Hello ");
System.out.print("World!");
3. Comments in Java
// Ye ek comment hai
/*
Ye ek multi-line comment hai
jo 2-3 line mein ho sakti hai
*/
Comments sirf code ko explain karne ke liye hoti hain.
Java Programming - Day 2 Notes
4. Escape Characters - Special Formatting
\n : New line
\t : Tab space
\" : Double quote
\\ : Backslash
Example:
System.out.println("Name:\tAli");
System.out.println("He said, \"Hello!\"");
5. Homework (Practice Task)
Ek nayi file banao MyBio.java aur ye likho:
public class MyBio {
public static void main(String[] args) {
System.out.println("Name:\tAbdul Haleem");
System.out.println("Father's Name:\tMr. Haleem");
System.out.println("Class:\tBS Software Engineering");
System.out.println("Quote:\t\"Success is a journey, not a destination.\"");