JavaJava · Chapterبەش 3 · Lectureوانە 3.2

Your First Java Program: Output and Commentsیەکەم بەرنامەی Javaـت: دەرخستە و لێدوانەکان

Write and understand your first Java program: the class and the file name, the main method and the boilerplate frame around your code, System.out.println and print, special characters, printing text and calculations, joining with +, escape sequences such as \n and \", and the three kinds of comments.

یەکەم Java بنووسە و تێی بگە: و ناوی ، و چوارچێوەی boilerplate لە دەوری کۆدەکەت، System.out.println و print، نیشانە تایبەتەکان، چاپکردنی دەق و ژمێرکاری، لکاندن بە +، وەک \n و \"، هەروەها سێ جۆرەکەی .

18 min read18 خولەک خوێندنەوە · 22 stepsهەنگاو

What you will learnچی فێر دەبیت

  • Write, save and run a Java program whose public class matches its file name.
  • Explain the parts of a program: class, main method, statement, string, semicolon and blocks, and recognise the boilerplate frame every program repeats.
  • Print text and calculations with println and print, join values with + and use escape sequences.
  • Write line, block and documentation comments, and explain why the compiler skips them.
  • Java بنووسیت، پاشەکەوتی بکەیت و جێبەجێی بکەیت کە publicـەکەی لەگەڵ ناوی بگونجێت.
  • بەشەکانی ڕوون بکەیتەوە: ، ، ، ، و بلۆکەکان، هەروەها ئەو چوارچێوە boilerplateـە بناسیتەوە کە هەموو دووپاتەی دەکاتەوە.
  • دەق و ژمێرکاری بە println و print چاپ بکەیت، بە + بلکێنیت و بەکار بهێنیت.
  • دێڕی، بلۆکی و بنووسیت و ڕوونی بکەیتەوە بۆچی تێیان دەپەڕێنێت.

Your first Java programیەکەم بەرنامەی Javaـت

A Hello, World! program shows the words Hello, World! on the screen. Because it is so small, programmers have used it as the first program in a new language since the 1970s. Here it is in Java:

⁦Hello, World!⁩ وشەکانی ⁦Hello, World!⁩ لەسەر شاشە پیشان دەدات. چونکە ئەوەندە بچووکە، لە ساڵانی ⁦1970⁩ـەوە وەک یەکەم لە زمانێکی نوێدا بەکاری دەهێنن. ئەمە وەشانی Javaـیەتی:

HelloWorld.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

Save it as HelloWorld.java — the file name must match the class name — and run it with your editor's Run button, or with javac HelloWorld.java and then java HelloWorld in a terminal. Compiling and running explains these two commands step by step.

بە ناوی HelloWorld.java پاشەکەوتی بکە — ناوی دەبێت وەک ناوی بێت — و بە دوگمەی Runـی دەستکاریکەرەکەت، یان بە javac HelloWorld.java و پاشان java HelloWorld لە جێبەجێی بکە. کۆمپایلکردن و جێبەجێکردن ئەم دوو هەنگاو بە هەنگاو ڕوون دەکاتەوە.

Left: an editor window with the file HelloWorld.java and its five numbered lines of code. An arrow labelled javac + java leads to the right: a dark console window that shows the output Hello, World!لای چەپ: پەنجەرەی دەستکاریکەرێک بە فایلی HelloWorld.java و پێنج دێڕە ژمارەدارەکەی کۆد. تیرێک بە نووسینی javac + java بەرەو لای ڕاست دەچێت: پەنجەرەیەکی تاریکی تێرمیناڵ کە دەرخستەکە Hello, World! پیشان دەدات.
You write the code in an editor; the output appears in a consoleکۆدەکە لە دەستکاریکەرێکدا دەنووسیت؛ لە دەردەکەوێتCêIT

The parts of a Java programبەشەکانی بەرنامەیەکی Java

Every line of a Java program has a job. Here is the same kind of program with another message, saved as Welcome.java:

هەموو دێڕێکی Java کارێکی هەیە. ئەمە هەمان جۆرە بە پەیامێکی ترەوە، بە ناوی Welcome.java پاشەکەوت کراوە:

Welcome.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class Welcome {
    public static void main(String[] args) {
        System.out.println("Welcome to Java!");
    }
}
The Welcome program with five numbered labels. 1: public class Welcome declares a class; its name matches the file Welcome.java. 2: public static void main(String[] args) is the main method, where the program starts. 3: System.out.println prints a line. 4: "Welcome to Java!" in double quotes is a string. 5: the semicolon ends the statement. Coloured brackets at the side show two blocks in curly braces: the class block and the method block.بەرنامەی Welcome بە پێنج ناونیشانی ژمارەدار. 1: public class Welcome کلاسێک دەناسێنێت؛ ناوەکەی وەک ناوی فایلی Welcome.javaـیە. 2: public static void main(String[] args) کرداری mainـە، شوێنی دەستپێکردنی بەرنامەکە. 3: System.out.println دێڕێک چاپ دەکات. 4: "Welcome to Java!" لە ناو نیشانەکانی گوتەدا زنجیرەنووسەیە. 5: خاڵبۆرەکە ڕستەکە تەواو دەکات. کەوانەی ڕەنگاوڕەنگ لە لاوە دوو بلۆک لە ناو کەوانەی لووتداردا پیشان دەدەن: بلۆکی کلاسەکە و بلۆکی میتۆدەکە.
Five parts every Java program hasپێنج بەش کە هەموو Java هەیەتیCêIT

The next screens look at the parts one by one: the class, the file name, the main method and the printing statement.

شاشەکانی داهاتوو یەک بە یەک سەیری بەشەکان دەکەن: ، ناوی ، و چاپکردن.

The parts of a Java programبەشەکانی بەرنامەیەکی Java

The class: a named containerکلاس: دەفرێک بە ناوێکەوە

public class Welcome declares a class called Welcome. Every Java program is made of one or more classes — they are the building blocks of Java — and every class has a name. Everything else lives inside the class's curly braces: the main method, and inside it the statements.

public class Welcome بە ناوی Welcome دەناسێنێت. هەموو Java لە یەک یان چەند پێک دێت — ئەوان خشتی بنیاتنانی Javaـن — و هەر ناوێکی هەیە. هەموو شتێکی تر لە ناو { }ـی : و لە ناو ئەویشدا .

Four nested boxes: the file Welcome.java contains the class Welcome; the class contains the method main; the method contains the statement System.out.println("Welcome to Java!");.چوار چوارچێوەی ناو یەک: فایلی Welcome.java کلاسی Welcome لەخۆ دەگرێت؛ کلاسەکە میتۆدی main لەخۆ دەگرێت؛ میتۆدەکە ڕستەی System.out.println("Welcome to Java!"); لەخۆ دەگرێت.
File, class, method, statement: each one inside the otherفایل، ، ، : هەریەکەیان لە ناو ئەوی ترداCêIT

The word public means that code everywhere may use the class. It is one of Java's access modifiers, which the classes chapter explains (Constructors and encapsulation).

وشەی public واتە هەموو کۆدێک بۆی هەیە ئەم بەکار بهێنێت. یەکێکە لە Java، کە بەشی ڕوونی دەکاتەوە (دروستکەرەکان و کەپسوولکردن).

The parts of a Java programبەشەکانی بەرنامەیەکی Java

One public class, named like the fileیەک کلاسی public، بە ناوی فایلەکەوە

  • A source file may contain at most one public class.
  • The public class must have exactly the same name as the file: public class Welcome lives in Welcome.java — same spelling, same capital letters.
  • By convention, a class name starts with a capital letter, and so does each new word inside it: HelloWorld, ComputeExpression. This style is called .
  • دەتوانێت لە یەک public زیاتری تێدا نەبێت.
  • publicـەکە دەبێت ڕێک هەمان ناوی هەبێت: public class Welcome لە Welcome.javaـدایە — هەمان ڕێنووس و هەمان پیتە گەورەکان.
  • بە نەریت، ناوی بە پیتی گەورە دەست پێ دەکات و هەر وشەیەکی نوێی ناویشی هەروا: HelloWorld، ComputeExpression. ئەم شێوازە پێی دەڵێن .
Two files side by side. Left: Shop.java holds public class Shop and a second class, Helper, without public — this is fine, and javac makes Shop.class and Helper.class. Right: another Shop.java holds two public classes, Shop and Price — javac stops with the error class Price is public, should be declared in a file named Price.java.دوو فایل لە تەنیشت یەکەوە. چەپ: Shop.java کلاسی public Shop و کلاسێکی دووەم، Helper، بەبێ public هەڵدەگرێت — ئەمە دروستە و javac فایلەکانی Shop.class و Helper.class دروست دەکات. ڕاست: فایلێکی تری Shop.java دوو کلاسێکی publicـی تێدایە، Shop و Price — javac بەم هەڵەیە دەوەستێت: class Price is public, should be declared in a file named Price.java.
Only one class per file may be public, and it gives the file its nameلە هەر فایلێکدا تەنیا یەک دەتوانێت public بێت و ناوی خۆی دەدات بە CêIT
A public class in a file with another nameکلاسێکی public لە فایلێکی ناو جیاوازداGreeting.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

The parts of a Java programبەشەکانی بەرنامەیەکی Java

The main method: where the program startsکرداری main: شوێنی دەستپێکردنی بەرنامەکە

public static void main(String[] args) defines the main method. A class may contain several methods, but when you run a program the JVM looks for this one and starts with its first statement: it is the program's entry point. Every Java application needs one, written exactly like this. This first line is the method's signature.

public static void main(String[] args) دەناسێنێت. دەتوانێت چەند هەبێت، بەڵام کاتێک جێبەجێ دەکەیت، JVM بە دوای ئەمەدا دەگەڕێت و بە یەکەم دەست پێ دەکات: ئەمە خاڵی چوونەژوورەوەی . هەموو Java یەکێکی پێویستە، ڕێک بەم شێوەیە نووسراو. ئەم دێڕە یەکەمە واژۆی .

The line public static void main(String[] args) with a label under each part: public — any code, also the JVM, may call it; static — it runs without creating an object; void — it gives no value back; main — the name the JVM looks for; String[] args — the words typed after the class name.دێڕی public static void main(String[] args) بە ناونیشانێک لە ژێر هەر بەشێکیدا: public — هەموو کۆدێک، JVMـیش، دەتوانێت بانگی بکات؛ static — بەبێ دروستکردنی ئۆبجێکتێک جێبەجێ دەبێت؛ void — هیچ نرخێک ناگەڕێنێتەوە؛ main — ئەو ناوەی JVM بە دوایدا دەگەڕێت؛ String[] args — ئەو وشانەی دوای ناوی کلاسەکە دەنووسرێن.
The five parts of the main method's first lineپێنج بەشەکەی یەکەم دێڕی CêIT

You do not need every word yet; later lessons explain static, void and arrays. One fact matters now: javac only translates the program. The JVM — started by the java command — is what runs it, beginning at main.

هێشتا پێویستت بە هەموو وشەیەک نییە؛ وانەکانی داهاتوو static، void و ڕوون دەکەنەوە. یەک ڕاستی ئێستا گرنگە: javac تەنیا وەردەگێڕێت. JVM — کە java دەستی پێ دەکات — ئەوەیە کە جێبەجێی دەکات، لە mainـەوە.

The parts of a Java programبەشەکانی بەرنامەیەکی Java

main is not Mainmain وەک Main نییە

Java is case-sensitive: main and Main are different names. If you write Main, the file still compiles — it is simply another method — but java cannot find the entry point and stops:

Java : main و Main دوو ناوی جیاوازن. ئەگەر Main بنووسیت، هێشتا کۆمپایل دەبێت — تەنیا ترە — بەڵام java خاڵی چوونەژوورەوە نادۆزێتەوە و دەوەستێت:

Welcome.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class Welcome {
    public static void Main(String[] args) {
        System.out.println("Welcome to Java!");
    }
}

The same happens if you leave out static: javac is happy, but java answers Error: Main method is not static in class Welcome. Copy the first line of main exactly.

هەمان شت ڕوو دەدات ئەگەر static لاببەیت: javac ڕازییە، بەڵام java وەڵام دەداتەوە Error: Main method is not static in class Welcome. یەکەم دێڕی main ڕێک وەک خۆی بنووسە.

The parts of a Java programبەشەکانی بەرنامەیەکی Java

Printing a line: System.out.printlnچاپکردنی دێڕێک: System.out.println

System.out.println("Welcome to Java!"); is a statement: one complete instruction. It displays the text on the console (the terminal window) and then moves to a new line. It sits inside the main method, which sits inside the class.

System.out.println("Welcome to Java!"); : یەک فەرمانی تەواو. دەقەکە لەسەر پیشان دەدات و پاشان دەچێتە دێڕێکی نوێ. لە ناو و ئەویش لە ناو .

The statement System.out.println("Welcome to Java!"); with labels: System is a ready-made class; out is the standard output, the console; println is the method that prints a line; the parentheses hold the argument; the text in double quotes is a string; the semicolon ends the statement.ڕستەی System.out.println("Welcome to Java!"); بە ناونیشانەوە: System کلاسێکی ئامادەیە؛ out دەرخستەی ستانداردە، واتە تێرمیناڵ؛ println ئەو میتۆدەیە کە دێڕێک چاپ دەکات؛ کەوانەکان ئارگیومێنتەکە هەڵدەگرن؛ دەقی ناو نیشانەکانی گوتە زنجیرەنووسەیە؛ خاڵبۆرەکە ڕستەکە تەواو دەکات.
The parts of a printing statementبەشەکانی چاپکردنCêIT
  • The text between double quotation marks is a string: a sequence of characters. The quotes are not printed.
  • Every statement ends with a semicolon ;, the statement terminator.
  • A pair of curly braces { } forms a block that groups parts of the program: the class has a block, and so does the main method.
  • ئەو دەقەی لە نێوان : زنجیرەیەک لە . چاپ ناکرێن.
  • هەموو بە ; کۆتایی دێت، کە کۆتاییهێنەری .
  • جووتێک { } پێک دەهێنێت کە بەشەکانی کۆ دەکاتەوە: بلۆکێکی هەیە و هەروا.

The parts of a Java programبەشەکانی بەرنامەیەکی Java

Boilerplate: the frame every program repeatsکۆدی boilerplate: ئەو چوارچێوەیەی هەموو بەرنامەیەک دووپاتەی دەکاتەوە

Put HelloWorld and Welcome side by side: only the class name and the line inside main differ. The class line, the main line and the closing braces are the same in every program. Set-up code like this, repeated almost unchanged wherever it is needed, is called boilerplate code. Java needs it as the program's frame; your program's own job is in the lines you write inside main.

HelloWorld و Welcome لە تەنیشت یەکتر دابنێ: تەنیا ناوی و ئەو دێڕەی ناو main جیاوازن. دێڕی ، دێڕی main و }ـە داخەرەکان لە هەموو وەک یەکن. کۆدی ئامادەکاری لەم جۆرە، کە لە هەر شوێنێک پێویست بێت بە نزیکەیی بێ گۆڕان دووپاتە دەبێتەوە، پێی دەڵێن boilerplate code. Java وەک چوارچێوەی پێویستی پێیەتی؛ کاری تایبەتی لەو دێڕانەدایە کە خۆت لە ناو mainـدا دەینووسیت.

Three programs side by side: HelloWorld.java, Welcome.java and Sum.java. In each, the class line, the main line and the two closing braces are shaded orange as boilerplate code, the same in all three; only the class name, in green, and the printing line inside main, shaded green, change. On the right: boilerplate code is the frame Java needs, the same every time; your own code is the part that does the program's own job. A small drawing shows where the name comes from: a metal printing plate and the same text in many newspapers.سێ بەرنامە لە تەنیشت یەک: HelloWorld.java، Welcome.java و Sum.java. لە هەریەکەیاندا دێڕی کلاس، دێڕی main و دوو کەوانەی داخستن بە پرتەقاڵی وەک کۆدی boilerplate ڕەنگ کراون، کە لە هەر سێکیاندا وەک یەکن؛ تەنیا ناوی کلاسەکە (بە سەوز) و دێڕی چاپکردن لە ناو main (بە سەوز) دەگۆڕێن. لای ڕاست: کۆدی boilerplate ئەو چوارچێوەیەیە کە Java پێویستی پێیەتی و هەموو جارێک وەک یەکە؛ کۆدی خۆت ئەو بەشەیە کە کاری تایبەتی بەرنامەکە دەکات. وێنەیەکی بچووک نیشان دەدات ناوەکە لە کوێوە هاتووە: پلێتێکی کانزایی چاپ و هەمان دەق لە زۆر ڕۆژنامەدا.
The frame is boilerplate; only the class name and the lines inside main changeچوارچێوەکە boilerplateـە؛ تەنیا ناوی و دێڕەکانی ناو main دەگۆڕێنCêIT

The name comes from printing. Boilerplate was the rolled steel used to build steam boilers. Newspapers later bought ready-made stories that arrived as metal printing plates looking much like it, so text that is copied without change got the same name. The French word cliché has the same story: once a printing plate, today a phrase used too often.

ناوەکە لە جیهانی چاپەوە هاتووە. boiler واتە گیزەر یان قازانی هەڵم و boilerplate ئەو پلێتە پۆڵایانە بوون کە قازانی هەڵمیان لێ دروست دەکرد. دواتر ڕۆژنامەکان چیرۆکی ئامادەیان دەکڕی کە وەک پلێتی کانزایی چاپ دەگەیشتن و زۆر لەو پلێتانە دەچوون، بۆیە ئەو دەقەی بێ گۆڕان کۆپی دەکرێت هەمان ناوی وەرگرت. وشەی «کڵێشە»ش هەمان چیرۆکی هەیە: لە ڕێگەی عەرەبییەوە لە وشەی فەڕەنسیی clichéـەوە هاتووە، کە پلێتێکی چاپ بوو و ئەمڕۆ بە واتای قسەیەکی زۆر دووپاتەکراوە دێت.

Other languages have boilerplate too: almost every web page starts with the same HTML skeleton (The structure of an HTML document), and flutter create gives every new Flutter project the same starter files (Create and run your first app). Since Java 25, a small program may leave most of Java's frame out (Newer Java).

زمانەکانی تریش کۆدی boilerplateـیان هەیە: نزیکەی هەموو بە هەمان ئێسکەپەیکەری HTML دەست پێ دەکات (پێکهاتەی بەڵگەنامەیەکی HTML) و flutter create هەمان سەرەتایی دەداتە هەموو پڕۆژەیەکی نوێی Flutter (دروستکردن و جێبەجێکردنی یەکەم ئەپ). لە ⁦Java 25⁩ـەوە، بچووک دەتوانێت زۆربەی چوارچێوەکەی Java لاببات (Javaـی نوێتر).

Special characters in Javaنیشانە تایبەتەکانی Java

These characters appear in almost every Java program. Learn their names: error messages use them.

ئەم نیشانانە لە نزیکەی هەموو Javaـدا دەردەکەون. ناوەکانیان فێر بە: بەکاریان دەهێنن.

CharacterنیشانەNameناوUsed forبۆ
{ }opening and closing bracesکەوانەی لووتدار (کردنەوە و داخستن)mark a block of statements لە دیاری دەکەن
( )opening and closing parenthesesکەوانەی ئاساییused with methods: println( … )لەگەڵ بەکار دێن: println( … )
[ ]opening and closing bracketsکەوانەی چوارگۆشەmark an array: String[] args (Arrays) دیاری دەکەن: String[] args (ڕیزەکەکان)
//double slashesدوو هێڵی لارstart a comment that runs to the end of the line دەست پێ دەکەن کە تا کۆتایی دێڕەکە دەڕوات
" "quotation marksenclose a string دەگرنە ناو خۆیان
;semicolonends a statement تەواو دەکات
The Welcome program with every pair joined by a coloured line: the braces of the class block, the braces of the method block, the parentheses after main, the brackets after String, the parentheses after println and the two quotation marks. The pairs sit inside each other and never cross.بەرنامەی Welcome کە هەموو جووتێکی بە هێڵێکی ڕەنگاوڕەنگ پێکەوە بەستراوە: کەوانە لووتدارەکانی بلۆکی کلاسەکە، کەوانە لووتدارەکانی بلۆکی میتۆدەکە، کەوانە ئاساییەکانی دوای main، کەوانە چوارگۆشەکانی دوای String، کەوانە ئاساییەکانی دوای println و هەردوو نیشانەی گوتەکە. جووتەکان لە ناو یەکدان و هەرگیز یەکتر نابڕن.
Every opening sign has its closing partnerهەموو نیشانەیەکی کردنەوە هاوبەشی داخستنی خۆی هەیەCêIT

Text or number?دەق یان ژمارە؟

Quotation marks decide what Java does. Text inside quotes is printed exactly as it is written. Without quotes, Java first works out the value of the expression and prints the result:

بڕیار دەدەن Java چی بکات. دەقی ناو ڕێک وەک نووسراوە چاپ دەکرێت. بەبێ ، Java سەرەتا دەدۆزێتەوە و ئەنجامەکە چاپ دەکات:

Test.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class Test {
    public static void main(String[] args) {
        System.out.println("39 + 3");
        System.out.println(39 + 3);
    }
}
Two rows. println("39 + 3") with quotes: the text is copied as it is, and the screen shows 39 + 3. println(39 + 3) without quotes: Java calculates first, and the screen shows 42.دوو ڕیز. println("39 + 3") لەگەڵ نیشانەی گوتە: دەقەکە وەک خۆی کۆپی دەکرێت و شاشە 39 + 3 پیشان دەدات. println(39 + 3) بەبێ نیشانەی گوتە: Java سەرەتا دەژمێرێت و شاشە 42 پیشان دەدات.
With quotes: text. Without quotes: a calculationلەگەڵ : دەق. بەبێ : ژمێرکاریCêIT

Joining text with +پێکەوەلکاندنی دەق بە +

When a string stands on either side of +, the + joins instead of adding: "Silav " + "Aram" becomes Silav Aram. This is called concatenation. Java works from left to right, so the order of the parts decides the result:

کاتێک لە هەر لایەکی + بێت، + لە جیاتی کۆکردنەوە پێکەوەیان دەلکێنێت: "Silav " + "Aram" دەبێتە Silav Aram. ئەمە پێی دەڵێن . Java لە چەپەوە بۆ ڕاست کار دەکات، بۆیە ڕیزبەندیی بەشەکان ئەنجامەکە دیاری دەکات:

Joining.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class Joining {
    public static void main(String[] args) {
        System.out.println("39 + 3 = " + 39 + 3);
        System.out.println("39 + 3 = " + (39 + 3));
        System.out.println(39 + 3 + " is the answer");
        System.out.println("Tea: " + 2 * 750 + " dinars");
    }
}
Explain the codeڕوونکردنەوەی کۆدەکە
Lineدێڕی 3

Text first: 39 is joined, then 3 is joined, giving 393.

سەرەتا دەق: ⁦39⁩ دەلکێنرێت، پاشان 3، کە دەبێتە ⁦393⁩.

Lineدێڕی 4

The brackets are worked out first: 39 + 3 = 42.

سەرەتا ناو کەوانەکە دەژمێردرێت: ⁦39 + 3 = 42⁩.

Lineدێڕی 5

Numbers first: 39 + 3 = 42, then the text is joined.

سەرەتا ژمارەکان: ⁦39 + 3 = 42⁩، پاشان دەقەکە دەلکێنرێت.

Lineدێڕی 6

* is done before +, so 2 * 750 = 1500 is joined as a number.

* پێش + ئەنجام دەدرێت، بۆیە ⁦2 * 750 = 1500⁩ وەک ژمارە دەلکێنرێت.

Two step-by-step evaluations. Top: "39 + 3 = " + 39 + 3 becomes "39 + 3 = 39" + 3 and then "39 + 3 = 393", because text on the left turns every + into joining. Bottom: "39 + 3 = " + (39 + 3): the brackets give 42 first, so the result is "39 + 3 = 42".دوو هەڵسەنگاندنی هەنگاو بە هەنگاو. سەرەوە: "39 + 3 = " + 39 + 3 دەبێتە "39 + 3 = 39" + 3 و پاشان "39 + 3 = 393"، چونکە دەقی لای چەپ هەموو +ـێک دەکات بە لکاندن. خوارەوە: "39 + 3 = " + (39 + 3): کەوانەکە سەرەتا 42 دەدات، بۆیە ئەنجامەکە "39 + 3 = 42"ـە.
Left to right: once text is involved, + joinsلە چەپەوە بۆ ڕاست: کاتێک دەق تێکەڵ بوو، + دەلکێنێتCêIT

This left-to-right order comes back in Operators, and Strings says more about mixing numbers with text.

ئەم ڕیزبەندییە لە چەپەوە بۆ ڕاست لە کارپێکەرەکاندا دووپاتە دێتەوە و زنجیرەنووسەکان زیاتر لەسەر تێکەڵکردنی ژمارە و دەق دەڵێت.

println takes one valueprintln تەنیا یەک نرخ وەردەگرێت

Can println print two strings separated by a comma? Try it: the program does not compile. (Only the first lines of javac's long message are shown.)

ئایا println دەتوانێت دوو چاپ بکات کە بە کۆما لێک جیا کراونەتەوە؟ تاقی بکەرەوە: کۆمپایل نابێت. (تەنیا یەکەم دێڕەکانی پەیامە درێژەکەی javac پیشان دراون.)

Test.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class Test {
    public static void main(String[] args) {
        System.out.println("Hello", "World!");
    }
}

javac then lists all ten versions of println (why there are ten): one with no value and nine that take one value each (text, a number, a character…). None takes two. To print both words, join them into one string:

پاشان javac یەک بە یەک ناوی هەر دە وەشانەکەی println دەهێنێت (بۆچی دە دانەن): یەکێکیان بێ و نۆیان هەریەکە یەک وەردەگرێت (دەق، ژمارە، …). هیچیان دوو وەرناگرێت. بۆ چاپکردنی هەردوو وشەکە، پێکەوەیان بلکێنە و بیانکە بە یەک :

Test.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class Test {
    public static void main(String[] args) {
        System.out.println("Hello" + " " + "World!");
    }
}

Printing the result of a calculationچاپکردنی ئەنجامی ژمێرکارییەک

Java can calculate and print in one statement. This program works out:

Java دەتوانێت لە یەک بژمێرێت و چاپ بکات. ئەم ئەمە دەژمێرێت:

10.5+2×345−3.5\frac{10.5 + 2 \times 3}{45 - 3.5}
ComputeExpression.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class ComputeExpression {
    public static void main(String[] args) {
        System.out.println((10.5 + 2 * 3) / (45 - 3.5));
    }
}
The fraction (10.5 + 2 × 3) over (45 − 3.5) turned into Java: the top becomes (10.5 + 2 * 3), the fraction bar becomes /, the bottom becomes (45 - 3.5), and the multiplication sign × becomes *.کەرتی (10.5 + 2 × 3) لەسەر (45 − 3.5) دەکرێت بە Java: سەرەوە دەبێتە (10.5 + 2 * 3)، هێڵی کەرت دەبێتە /، خوارەوە دەبێتە (45 - 3.5) و نیشانەی لێکدانی × دەبێتە *.
From a maths formula to a Java expressionلە هاوکێشەیەکی بیرکارییەوە بۆ JavaCêIT

In Java the multiplication sign is * and division is /. The fraction bar groups the top and the bottom, so each needs its own brackets; Java always works out what is inside brackets first.

لە Javaـدا نیشانەی لێکدان *ـە و دابەشکردن /ـە. هێڵی کەرت سەرەوە و خوارەوە کۆ دەکاتەوە، بۆیە هەریەکەیان کەوانەی خۆی پێویستە؛ Java هەمیشە سەرەتا ناو کەوانەکان دەژمێرێت.

Special characters inside strings: escape sequencesهێما تایبەتەکان لە ناو زنجیرەنووسەدا

How do you print a quotation mark, when a quotation mark ends the string? Inside a string, a backslash \ starts an escape sequence: the backslash and the next character together stand for one special character.

چۆن چاپ دەکەیت، کاتێک کۆتایی پێ دەهێنێت؟ لە ناو ، \ دەست پێ دەکات: و دوای ئەو پێکەوە جێگەی یەک تایبەت دەگرنەوە.

WriteبنووسەYou getدەردەچێت
\na new lineدێڕێکی نوێ ()
\ta tab (a jump to the next column)تاب (بازدان بۆ ستوونی داهاتوو)
\"a double quote: " دووانە: "
\'a single quote: ' تاک: '
\\one backslash: \یەک : \
Escapes.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class Escapes {
    public static void main(String[] args) {
        System.out.println("Line 1\nLine 2");
        System.out.println("Name:\tDilan");
        System.out.println("She said \"Silav\" to us.");
        System.out.println("Folder: C:\\examples");
    }
}
The string "She said \"Silav\" to us." read from left to right: the first quotation mark opens the string; each backslash-quote pair becomes a quote that is printed; the last quotation mark closes the string. Below, the screen shows She said "Silav" to us.زنجیرەنووسەی "She said \"Silav\" to us." لە چەپەوە بۆ ڕاست دەخوێنرێتەوە: یەکەم نیشانەی گوتە زنجیرەنووسەکە دەکاتەوە؛ هەر جووتێکی هێڵی لاری پێچەوانە و نیشانەی گوتە دەبێتە نیشانەیەکی گوتە کە چاپ دەکرێت؛ دوایین نیشانەی گوتە زنجیرەنووسەکە دادەخات. لە خوارەوە، شاشە She said "Silav" to us. پیشان دەدات.
How Java reads quotation marks inside a stringJava چۆن ناو دەخوێنێتەوەCêIT

You meet these special characters again when you work with text in Strings.

کاتێک لە زنجیرەنووسەکاندا کار لەسەر دەق دەکەیت، دووپاتە ئەم نیشانە تایبەتانە دەبینیتەوە.

Comments: notes for peopleلێدوانەکان: تێبینی بۆ مرۆڤ

A comment is a note for people who read the code. The compiler skips comments completely: they never reach the bytecode and never run. Comments can explain a variable, a method, a class or any statement.

تێبینییەکە بۆ ئەو کەسانەی کۆدەکە دەخوێننەوە. بە تەواوی تێدەپەڕێنێت: هەرگیز ناگەنە و هەرگیز جێبەجێ ناکرێن. دەتوانن ، ، یان هەر ڕوون بکەنەوە.

A short program with its three kinds of comment coloured: a documentation comment starting with /** above the class, a block comment between /* and */ inside main, and a line comment after //. An arrow through javac shows that all comments are dropped: the .class file contains only the code.بەرنامەیەکی کورت کە سێ جۆرە لێدوانەکەی ڕەنگ کراون: لێدوانێکی بەڵگەنامە کە بە /** دەست پێ دەکات لە سەرووی کلاسەکە، لێدوانێکی بلۆکی لە نێوان /* و */ لە ناو main و لێدوانێکی دێڕی دوای //. تیرێک بە ناو javacـدا پیشان دەدات کە هەموو لێدوانەکان فڕێ دەدرێن: فایلی .class تەنیا کۆدەکەی تێدایە.
Three kinds of comment; javac skips them allسێ جۆر ؛ javac هەموویان تێدەپەڕێنێتCêIT
  • You can go back to code you wrote days or months ago and quickly see what each part does.
  • Other people understand your logic by reading the comments instead of every line.
  • As a project grows, the comments become part of its documentation, which keeps it manageable.
  • دەتوانیت بگەڕێیتەوە بۆ ئەو کۆدەی ڕۆژان یان مانگان پێش ئێستا نووسیوتە و بە خێرایی ببینیت هەر بەشێکی چی دەکات.
  • خەڵکی تر بە خوێندنەوەی لە جیاتی هەموو دێڕێک لۆجیکەکەت تێدەگەن.
  • کاتێک پڕۆژەیەک گەورە دەبێت، دەبنە بەشێک لە و بەڕێوەبردنی ئاسان دەهێڵنەوە.

Comments: notes for peopleلێدوانەکان: تێبینی بۆ مرۆڤ

Line comments and block commentsلێدوانەکانی دێڕی و بلۆکی

A line comment starts with // and runs to the end of that line, so it can follow code on the same line:

دێڕی بە // دەست پێ دەکات و تا کۆتایی ئەو دێڕە دەڕوات، بۆیە دەتوانێت لەسەر هەمان دێڕ دوای کۆد بێت:

CommentExample1.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class CommentExample1 {
    public static void main(String[] args) {
        int i = 10; // Here, i is a variable
        System.out.println(i);
    }
}

A block comment starts with /* and ends with */, on one line or across several:

بلۆکی بە /* دەست پێ دەکات و بە */ کۆتایی دێت، لەسەر یەک دێڕ یان چەند دێڕێک:

CommentExample2.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class CommentExample2 {
    public static void main(String[] args) {
        /* Let's declare a variable
           and print it. */
        int i = 10;
        System.out.println(i);
    }
}

(int i = 10; creates a variable that holds the number 10; Variables explains it.) Comment marks inside a string are just text: System.out.println("// this is text, not a comment"); prints // this is text, not a comment.

(int i = 10; دروست دەکات کە ژمارەی ⁦10⁩ هەڵدەگرێت؛ گۆڕاوەکان ڕوونی دەکاتەوە.) نیشانەکانی لە ناو تەنیا دەقن: System.out.println("// this is text, not a comment"); دەقی // this is text, not a comment چاپ دەکات.

Comments: notes for peopleلێدوانەکان: تێبینی بۆ مرۆڤ

Documentation comments and javadocلێدوانەکانی بەڵگەنامە و javadoc

Java has a third kind: a documentation comment starts with /** and ends with */. You write it just above a class or a method to explain it. The JDK tool javadoc collects these comments and makes web pages from them — the same kind of pages as the official Java API documentation (Reading the API documentation).

Java جۆرێکی سێیەمیشی هەیە: بە /** دەست پێ دەکات و بە */ کۆتایی دێت. ڕێک لە سەرووی یان دەینووسیت بۆ ڕوونکردنەوەی. ئامرازی javadocـی JDK ئەم کۆ دەکاتەوە و لاپەڕەی وێبیان لێ دروست دەکات — هەمان جۆری لاپەڕەکانی فەرمیی Java (خوێندنەوەی بەڵگەنامەی API).

Greeter.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
/**
 * Prints a short greeting for the tea house.
 * The javadoc tool turns this comment into a web page.
 */
public class Greeter {

    /**
     * Starts the program.
     * @param args not used in this program
     */
    public static void main(String[] args) {
        // Show one line of text
        System.out.println("Silav! Welcome to our tea house.");
    }
}
BASHType in a terminalلە تێرمیناڵدا بینووسە
javadoc -d docs Greeter.java
Left: the documentation comment above class Greeter in the source file. An arrow labelled javadoc leads to the right: a web page titled Class Greeter that shows the comment's text, Prints a short greeting for the tea house, and the method main with its parameter args.لای چەپ: لێدوانی بەڵگەنامەکە لە سەرووی class Greeter لە فایلی سەرچاوەدا. تیرێک بە نووسینی javadoc دەچێتە لای ڕاست: لاپەڕەیەکی وێب بە ناونیشانی Class Greeter کە دەقی لێدوانەکە (Prints a short greeting for the tea house) و میتۆدەکە main لەگەڵ پارامیتەرەکەی args پیشان دەدات.
javadoc turns documentation comments into web pagesjavadoc دەکات بە لاپەڕەی وێبCêIT

Comments: notes for peopleلێدوانەکان: تێبینی بۆ مرۆڤ

Writing good commentsنووسینی لێدوانێکی باش

  • Say why, not what. The code already shows what happens; a good comment adds the reason.
  • Keep comments true: when you change the code, change its comment too.
  • To switch a line off for a moment, put // in front of it (commenting out); delete such lines once you are sure you do not need them.
  • Start each class with a /** … */ comment that says what it is for.
  • بۆچی بڵێ، نەک چی. کۆدەکە خۆی پیشان دەدات چی ڕوو دەدات؛ باش هۆکارەکە زیاد دەکات.
  • ڕاست بهێڵەرەوە: کاتێک کۆدەکە دەگۆڕیت، بگۆڕە.
  • بۆ ئەوەی دێڕێک بۆ ماوەیەک بکوژێنیتەوە، // بخەرە پێشی؛ کاتێک دڵنیا بوویت پێویستت پێیان نییە، ئەو دێڕانە بسڕەوە.
  • هەر بە /** … */ دەست پێ بکە کە بڵێت بۆ چییە.
TeaOrder.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
/**
 * Prints the bill for a tea-house order.
 */
public class TeaOrder {
    public static void main(String[] args) {
        // 3 teas at 750 dinars each; the price list changed in 2026
        System.out.println("Teas: " + 3 * 750 + " dinars");
        /* The cake is free today, so it is not on the bill.
           System.out.println("Cake: 2000 dinars"); */
        System.out.println("Thank you!");
    }
}
Explain the codeڕوونکردنەوەی کۆدەکە
Lineدێڕی 6

A why comment: where the numbers come from.

بۆچی: ژمارەکان لە کوێوە هاتوون.

Lineدێڕی 8-9

A commented-out line with the reason it is switched off.

دێڕێکی کوژێنراوە لەگەڵ هۆکاری کوژاندنەوەکەی.

Two comments for the same line System.out.println("Teas: " + 3 * 750 + " dinars");. Weak: // print the teas — it only repeats the code. Better: // 3 teas at 750 dinars each; the price list changed in 2026 — it explains where the numbers come from.دوو لێدوان بۆ هەمان دێڕی System.out.println("Teas: " + 3 * 750 + " dinars");. لاواز: // print the teas — تەنیا کۆدەکە دووپاتە دەکاتەوە. باشتر: // 3 teas at 750 dinars each; the price list changed in 2026 — ڕوون دەکاتەوە ژمارەکان لە کوێوە هاتوون.
A good comment explains why باش بۆچییەکە ڕوون دەکاتەوەCêIT

Common mistakesهەڵە باوەکان

Every message below is the real output of javac 17. The first line of a javac message names the file and the line number; fix the first error first, then compile again.

هەموو پەیامێکی خوارەوە ڕاستەقینەی javac ⁦17⁩ـە. یەکەم دێڕی پەیامێکی javac ناوی و ژمارەی دێڕەکە دەڵێت؛ سەرەتا یەکەم هەڵە چاک بکە، پاشان دووپاتە کۆمپایل بکەرەوە.

You wroteنووسیتjavac saysjavac دەڵێتFixچارەسەر
System.out.println("Hi")error: ';' expectedAdd ; at the end of the statement.; لە کۆتایی زیاد بکە.
system.out.println("Hi");error: package system does not existWrite System with a capital S.System بە Sـی گەورە بنووسە.
System.out.Println("Hi");error: cannot find symbol symbol: method Println(String)Write println in small letters.println بە پیتی بچووک بنووسە.
System.out.printIn("Hi");error: cannot find symbol symbol: method printIn(String)It is println with a small L (line), not a capital I.printlnـە بە Lـی بچووک (line)، نەک Iـی گەورە.
System.out.println("Hi);error: unclosed string literalClose the string with ". بە " دابخە.
System.out.println('Hi');error: unclosed character literalStrings need double quotes: "Hi". دووانەی پێویستە: "Hi".
System.out.println(“Hi”);error: illegal character: '\u201c'Curly quotes from a word processor: retype them as straight quotes ". : بە " بیاننووسەرەوە.
(45 – 3.5)error: illegal character: '\u2013'A dash copied from a PDF looks like a minus: type - yourself.داشێک کە لە PDFـەوە کۆپی کراوە وەک نیشانەی کەم دەردەکەوێت: - خۆت بنووسە.
System.out.println(Hi);error: cannot find symbol symbol: variable HiText needs quotes: "Hi".دەق پێویستە: "Hi".
A missing last }دوایین } کەمەerror: reached end of file while parsingEvery { needs its }.هەر {ـێک }ـی خۆی پێویستە.
main(string[] args)error: cannot find symbol symbol: class stringWrite String with a capital S.String بە Sـی گەورە بنووسە.
/* a /* b */ c */error: illegal start of expressionBlock comments do not nest: the first */ ends the comment. بلۆکی لە ناو یەکدا دانانرێن: یەکەم */ تەواو دەکات.

Two mistakes compile but stop at run time: Main instead of main gives Main method not found, and a missing static gives Main method is not static (see main is not Main). Errors and debugging teaches how to read any error message, and why copied code often fails (Copy-paste traps).

دوو هەڵە کۆمپایل دەبن بەڵام لە دەوەستن: Main لە جیاتی main دەبێتە Main method not found و نەبوونی static دەبێتە Main method is not static (بڕوانە main وەک Main نییە). هەڵەکان و کرمەکوژی فێرت دەکات چۆن هەر بخوێنیتەوە و بۆچی کۆدی کۆپیکراو زۆرجار کار ناکات (داوەکانی کۆپیکردن).

Practiceڕاهێنان

ExerciseڕاهێنانPredict the outputدەرخستە پێشبینی بکە

Without running them, write down exactly what each line prints. Then run them and compare.

بەبێ جێبەجێکردن، بە وردی بنووسە هەر دێڕێک چی چاپ دەکات. پاشان جێبەجێیان بکە و بەراوردیان بکە.

JAVA
System.out.println("39 + 3");
System.out.println(39 + 3);
System.out.print("Hello");
System.out.println("World");
System.out.println((80 + 90) / 2.0);
System.out.println(80 + 90 / 2.0);
Show answerوەڵامەکە پیشان بدە
Outputدەرئەنجام
39 + 3
42
HelloWorld
85.0
125.0

Line 1 is text in quotes; line 2 is a sum. print keeps Hello and World on one line. In line 5 the brackets come first: 170 / 2.0 = 85.0. In line 6 division comes before addition: 80 + 45.0 = 125.0.

دێڕی 1 دەقێکە لە ناو ؛ دێڕی 2 کۆکردنەوەیە. print Hello و World لەسەر یەک دێڕ دەهێڵێتەوە. لە دێڕی 5دا کەوانەکان یەکەمن: ⁦170 / 2.0 = 85.0⁩. لە دێڕی 6دا دابەشکردن پێش کۆکردنەوە دێت: ⁦80 + 45.0 = 125.0⁩.

ExerciseڕاهێنانDraw with textبە دەق وێنە بکێشە

Write a program that prints the word HI in big letters, and a second program that prints this little house. Use one println per line. Hint for the house: every backslash must be written as \\.

بنووسە کە وشەی HI بە پیتی گەورە چاپ بکات و دووەم کە ئەم خانووە بچووکە چاپ بکات. بۆ هەر دێڕێک یەک println بەکار بهێنە. ئاماژە بۆ خانووەکە: هەموو دەبێت وەک \\ بنووسرێت.

Outputدەرئەنجام
    /\
   /  \
  /    \
 /______\
 |  __  |
 | |  | |
 |_|__|_|
Hintئاماژە

Copy each line of the picture into a string. In Java code, \\ prints one backslash.

هەر دێڕێکی وێنەکە بخەرە ناو . لە کۆدی Javaـدا \\ یەک چاپ دەکات.

Show answerوەڵامەکە پیشان بدە
Hi.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class Hi {
    public static void main(String[] args) {
        System.out.println("H   H   III");
        System.out.println("H   H    I");
        System.out.println("HHHHH    I");
        System.out.println("H   H    I");
        System.out.println("H   H   III");
    }
}
House.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class House {
    public static void main(String[] args) {
        System.out.println("    /\\");
        System.out.println("   /  \\");
        System.out.println("  /    \\");
        System.out.println(" /______\\");
        System.out.println(" |  __  |");
        System.out.println(" | |  | |");
        System.out.println(" |_|__|_|");
    }
}
ExerciseڕاهێنانA sign with quotesتابلۆیەک بە نیشانەی گوتە

Print this sign exactly, quotes and backslashes included:

ئەم تابلۆیە ڕێک وەک خۆی چاپ بکە، لەگەڵ و :

Outputدەرئەنجام
+----------------+
|  "Silav!"      |
|  C:\Tea\Shop   |
+----------------+
Show answerوەڵامەکە پیشان بدە
Sign.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class Sign {
    public static void main(String[] args) {
        System.out.println("+----------------+");
        System.out.println("|  \"Silav!\"      |");
        System.out.println("|  C:\\Tea\\Shop   |");
        System.out.println("+----------------+");
    }
}
ExerciseڕاهێنانCompute an expressionدەربڕینێک بژمێرە

Write a program that displays the result of this formula. Work it out by hand too.

بنووسە کە ئەنجامی ئەم هاوکێشەیە پیشان بدات. بە دەستیش بیژمێرە.

9.5×4.5−2.5×345.5−3.5\frac{9.5 \times 4.5 - 2.5 \times 3}{45.5 - 3.5}
Show answerوەڵامەکە پیشان بدە
Task4.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class Task4 {
    public static void main(String[] args) {
        System.out.println((9.5 * 4.5 - 2.5 * 3) / (45.5 - 3.5));
    }
}
9.5×4.5−2.5×345.5−3.5=42.75−7.542=35.2542≈0.839\frac{9.5 \times 4.5 - 2.5 \times 3}{45.5 - 3.5} = \frac{42.75 - 7.5}{42} = \frac{35.25}{42} \approx 0.839
ExerciseڕاهێنانYour name, top to bottomناوەکەت، لە سەرەوە بۆ خوارەوە

Display your name vertically, one letter per line. Do it twice: once with one println per letter, and once with a single println and \n.

ناوەکەت بە ستوونی پیشان بدە، لە هەر دێڕێکدا یەک پیت. دوو جار بیکە: جارێک بە یەک println بۆ هەر پیتێک و جارێک بە تەنیا یەک println و \n.

Show answerوەڵامەکە پیشان بدە
Vertical.javaJAVAType in a terminalلە تێرمیناڵدا بینووسە
public class Vertical {
    public static void main(String[] args) {
        System.out.println("D\ni\nl\na\nn");
    }
}

With one println per letter you write System.out.println("D");, System.out.println("i"); and so on. After the loops chapter you can let a loop print any name.

بە یەک println بۆ هەر پیتێک دەنووسیت System.out.println("D");، System.out.println("i"); و بەم شێوەیە. دوای بەشی دەتوانیت ڕێگە بدەیت هەر ناوێک چاپ بکات.

Summaryپوختە

  • A Java program is made of classes. The public class has the same name as its file: public class Welcome → Welcome.java.
  • public static void main(String[] args) is the entry point; the JVM starts running there. Java is case-sensitive: main, not Main.
  • The class line, the main line and the braces are boilerplate code: the same frame in every program; your own work is the lines inside main.
  • Statements end with ;, blocks sit in { }, strings sit in double quotes.
  • println prints and ends the line; print stays on the line. println takes one value: join text with +, left to right.
  • Without quotes Java calculates: brackets first, * and / before + and -.
  • Escape sequences put special characters in strings: \n, \t, \", \', \\.
  • Comments are for people and are skipped by the compiler: // line, /* */ block, /** */ documentation for javadoc.
  • Java لە پێک دێت. publicـەکە هەمان ناوی هەیە: public class Welcome ← Welcome.java.
  • public static void main(String[] args) خاڵی چوونەژوورەوەیە؛ JVM لەوێوە دەست بە جێبەجێکردن دەکات. Java : main، نەک Main.
  • دێڕی ، دێڕی main و کەوانەکان boilerplate codeـن: هەمان چوارچێوە لە هەموو ؛ کاری خۆت ئەو دێڕانەن کە لە ناو mainـدان.
  • بە ; کۆتایی دێن، بلۆکەکان لە ناو { }ـدان و لە ناو دووانەدان.
  • println چاپ دەکات و دێڕەکە تەواو دەکات؛ print لەسەر دێڕەکە دەمێنێتەوە. println یەک وەردەگرێت: دەق بە + بلکێنە، لە چەپەوە بۆ ڕاست.
  • بەبێ Java دەژمێرێت: سەرەتا کەوانەکان، * و / پێش + و -.
  • تایبەت دەخەنە ناو : \n، \t، \"، \'، \\.
  • بۆ مرۆڤن و تێیان دەپەڕێنێت: // دێڕی، /* */ بلۆکی، /** */ بۆ javadoc.
Review questionsپرسیارەکانی پێداچوونەوە
Why does public class Shop in shop.java fail?بۆچی public class Shop لە shop.javaـدا سەرکەوتوو نابێت؟

A public class must sit in a file with exactly its name, capital letters included: Shop.java.

public دەبێت لە فایلێکدا بێت کە ڕێک ناوی خۆی هەبێت، پیتە گەورەکانیشەوە: Shop.java.

What is the difference between print and println?جیاوازیی print و println چییە؟

println ends the line after printing; print does not.

println دوای چاپکردن دێڕەکە تەواو دەکات؛ print وا ناکات.

What does "5" + 5 give, and what does 5 + 5?"5" + 5 چی دەدات و 5 + 5 چی؟

"5" + 5 joins to the text 55; 5 + 5 adds to the number 10.

"5" + 5 دەلکێت و دەبێتە دەقی 55؛ 5 + 5 کۆ دەکرێتەوە و دەبێتە ژمارەی ⁦10⁩.

Do comments make a program slower?ئایا لێدوانەکان بەرنامەیەک هێواشتر دەکەن؟

No. The compiler skips them, so they are not in the bytecode at all.

نەخێر. تێیان دەپەڕێنێت، بۆیە هەر لە نین.

Lesson complete!وانەکە تەواو بوو!

Well done. Review the key terms, then go on to the next lesson.دەستخۆش. سەیرێکی زاراوە سەرەکییەکان بکەرەوە، پاشان بڕۆ بۆ وانەی داهاتوو.

Key termsزاراوە سەرەکییەکان

Next lessonوانەی داهاتوو

Compiling and Running: javac, Bytecode and the JVMکۆمپایلکردن و جێبەجێکردن: javac، بایتکۆد و ئامێری گریمانەیی Java

References and further readingسەرچاوەکان و خوێندنەوەی زیاتر

This lecture is a first edition. The Kurdish text and terminology are waiting for review by Kurdish IT teachers.ئەم وانەیە چاپی یەکەمە. دەقە کوردییەکە و زاراوەکانی چاوەڕێی پێداچوونەوەی مامۆستایانی کوردی بواری IT ن.

Appearanceڕووکار

Modeدۆخ
Styleشێواز
Coloursڕەنگەکان

Saved on this device only.تەنیا لەسەر ئەم ئامێرە پاشەکەوت دەکرێت.