A snippet kuliah karo mentor minangka bagéan saka kursus Universitas Codegym. Ndaftar kanggo kursus lengkap.


"Halo, Amigo."

"Halo, Eleanor Carrey."

"Sebut wae aku Ellie. Ora perlu formal banget."

"Oke, Ellie."

"Aku yakin kanthi bantuanku, sampeyan bakal dadi salah siji sing paling apik. Aku duwe akeh pengalaman latihan wong anyar. Tetep karo aku, lan kabeh bakal apik. Ayo, ayo miwiti."

"Ana rong jinis utama ing Jawa : String lan int . Kita nyimpen strings/teks ing String, lan integers (nomer wutuh) ing int. Kanggo mratelakake variabel anyar, sampeyan kudu nemtokake jinis lan jeneng sawijining. Jeneng ora bisa dadi padha karo jeneng variabel lan/utawa fungsi liyane."

Tuladha 1, kode: Katrangan
String s;
Variabel anyar sdiumumake. Bisa nyimpen teks.
int i;
Variabel anyar i, diumumake. Bisa nyimpen integer.

"Sampeyan bisa nemtokake nilai kanggo variabel nalika sampeyan ngumumake."

Tuladha 2, kode: Katrangan
String s = "Ellie";
Variabel snyimpen string "Ellie".
int i = 5;
Variabel inyimpen nomer 5.

"Kanggo nemtokake nilai anyar kanggo variabel, kita nggunakake tandha =. Iki uga disebut 'operator penugasan' . Assignment tegese kanggo nyelehake menyang variabel nilai saka variabel liyane utawa siji diitung saka sawetara variabel. "

Tuladha 3, kode: Katrangan
int a = 5;
Variabel anyimpen nilai 5.
int b = 6;
Variabel bnyimpen nilai 6.
int c = a + b;
Variabel cnyimpen nilai 11.

"Nilai variabel bisa digunakake kanggo ngitung nilai anyar sing bakal ngganti sing lawas."

Tuladha 4, kode: Katrangan
int a = 2;
Saiki apadha karo 2
int b = 3;
Saiki bpadha karo 3
a = a + b;
Saiki apadha karo 5
b = b + 1;
Saiki bpadha karo 4

"Sampeyan bisa nggabungake string karo +tandha:"

Tuladha 5, kode: Katrangan
String s1 = "Rain";
String s2 = "In";
String s3 = s1 + s2 + "Spain";
Variabel s3nyimpen senar"RainInSpain"

"Kadhangkala, string sing dumadi saka siji utawa luwih spasi bisa migunani:"

Tuladha 6, kode: Katrangan
String s1 = "My favorite movie is";
String s2 = "Route";
int roadNumber = 66;
String text = s1 + " " + s2 + " " + roadNumber;
texttoko"My favorite movie is Route 66"

"Ayo deleng carane nampilake teks lan variabel ing layar:"

Ngenalake ints lan String - 1
Tuladha 7, kode:
1
System.out.println("A man's gotta do what a man's gotta do");
2
String s = "A man's gotta do what a man's gotta do";
System.out.println(s);

"Oalah, Diego njaluk aku menehi sawetara latihan:"