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

Java Day2 Notes

The document provides notes on Java programming, covering the main() method as the program's entry point, the use of System.out.println() for printing output, and the importance of comments. It also explains escape characters for special formatting in strings. Additionally, it includes a homework task to create a MyBio.java file with specific output requirements.

Uploaded by

abdulhaleem47222
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)
8 views2 pages

Java Day2 Notes

The document provides notes on Java programming, covering the main() method as the program's entry point, the use of System.out.println() for printing output, and the importance of comments. It also explains escape characters for special formatting in strings. Additionally, it includes a homework task to create a MyBio.java file with specific output requirements.

Uploaded by

abdulhaleem47222
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

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.\"");

You might also like