Java Syntax — தமிழ்

</>Coding Tamilan.← Java course & curriculum
Java Masterclass · Lesson 03 / 50 · தமிழ்

Java Syntax

Make the code make sense.

Step-by-step explanationsRunnable JavaPractice + answer

முக்கிய விளக்கங்கள் தமிழில் உள்ளன. Runnable example மற்றும் கூடுதல் practice notes ஆங்கிலத்தில் உள்ளன.

இந்தப் பாடத்தில்…

  • Explain the key idea behind Syntax.
  • Read and run a complete example, then predict what changes.
  • Recognize the topic-specific mistake discussed below.
01 / The concept

அடிப்படையைப் புரிந்துகொள்ளுங்கள்

Read a conventional Java program as three layers: the class, the main method, and the statements inside it. Braces define blocks, the public class name matches the filename in this example, and a println statement ends with a semicolon.

02 / Step by step

விரிவான விளக்கங்கள்

Java Syntax என்னன்னு பார்க்கலாம்

முந்தைய chapter-ல Main.java file create பண்ணி "Hello World" print பண்ணினோம். அந்த code-ஐ இப்போ explain பண்றோம்:

Example விளக்கம்

Java-ல run ஆகுற எல்லா code-உம் ஒரு class-க்கு உள்ளே இருக்கணும். Class பேர் capital letter-ல ஆரம்பிக்கணும். நம்ம example-ல Main-ன்னு வச்சிருக்கோம்.

குறிப்பு: Java case-sensitive — MyClass-உம் myclass-உம் different-ஆ treat ஆகும்.

Java file பேர் class பேரோட exactly match ஆகணும். Class பேர் Main-ன்னா file Main.java-ன்னுதான் save ஆகணும். இல்லன்னா Java error குடுக்கும்.

main() Method

எல்லா Java program-லயும் main() method இருக்கணும் — program இங்கிருந்துதான் start ஆகும்:

main()-க்கு உள்ளே வர்ற எல்லா code-உம் execute ஆகும்.

இப்போதைக்கு public, static, void keywords பத்தி கவலைப்படவேண்டாம். பிறகு கற்றுக்கொள்வோம். நினைவு வச்சுக்க: main()தான் ஆரம்ப point.

System.out.println()

main()-க்கு உள்ளே println() use பண்ணி screen-ல text print பண்ணலாம்:

குறிப்பு: {} ஒரு block-ஓட ஆரம்பத்தையும் முடிவையுங்கள்யும் mark பண்றது.System.out.println() long-ஆ தெரியுது, ஆனா இதை ஒரே command மாதிரி நினைவில் வையுங்கள்த்துக்கொள்ளுங்கள்: "இந்த text-ஐ screen-ல போடு"System — built-in Java classout — output-ஐ represent பண்றதுprintln() — "print line" என்று அர்த்தம்ஒவ்வொரு Java statement-உம் semicolon (;)-ல முடியணும்.

Java reference fragmentJAVA
public class HelloWorld {
    public static void main(String[] args) {
        int age = 25;
        String name = "Alice";
        System.out.println("Name: " + name + ", Age: " + age);
        // Output: Name: Alice, Age: 25
    }
}

எந்த ஒரு Java program-உம் எதிலிருந்து execute ஆக தொடங்குகிறது?

  1. public class லிருந்து
  2. System.out.println() லிருந்து
  3. main() method-லிருந்து
  4. முதல் line-லிருந்து
Reveal answer / விடை

main() method-லிருந்து

Java-வில் execution எப்போதும் `main()` method-லிருந்து தான் தொடங்கும். இதுவே program-இன் starting point.

03 / Read and predict

முழுமையான உதாரணம்

This complete Main.java program focuses on the lesson idea. Reference fragments above may demonstrate individual statements; this example includes the imports, entry point, and supporting types it needs.

Main.java · complete runnable exampleJAVA
public class Main {
    public static void main(String[] args) throws Exception {
        System.out.println("Vanakkam, developer!");
        System.out.println("One small program is a good start.");
    }
}
Predict first. Then reveal the expected output / வெளியீடு
Vanakkam, developer!
One small program is a good start.

The output shown was checked by running this complete example. Trace the executed statements in order, then compare with your run.

04 / Learn by changing

Change it. Run it. Understand it.

Load this lesson example into the editor. Change one value or statement, predict the result, then press RUN to execute Java.

Open Java editor ↗
After the editor loads, choose Load this lesson example, then press RUN.

Powered by OneCompiler. Code you run is sent to OneCompiler for execution. For Scanner examples, supply input in the editor I/O panel; for file examples, files exist in its execution environment.

05 / Your turn

நீங்களே முயற்சி செய்யுங்கள்

Practice challenge

Change the greeting, add another println, and then intentionally remove one semicolon to see the compiler diagnostic.

Reveal the answer and reasoning / விடை

Restore the semicolon after println(…). Run again and compare the successful output with the diagnostic from the broken version.

தவிர்க்க வேண்டிய தவறு: Java is case-sensitive: use System with uppercase S and main with lowercase m.

பாடத்தின் சுருக்கம்

  • Explain the example without reading the output first.
  • Make the change requested in the practice task.
  • Describe why the result changed—or why compilation failed.

Ready to move on? Follow the next lesson in course order, or return to the curriculum to review a prerequisite.

Coding Tamilan · Understand the idea. Try the code. Build the habit.