Java qanday qismlardan iborat va bu qismlarni tushuntiring? Jdk, jre va jvm lar nima va qanday vazifalarni bajaradi?
Download 32.52 Kb.
|
var Java
public class ReplaceExample{
public static void main(String args[]){ String s1="my name is program my name is java"; String replaceString=s1.replace("is","was"); //replaces all occurrences of "is" to "was" System.out.println(replaceString); }} Quyidagi kod ektanga nimani chiqaradi? public class LengthExample{ public static void main(String args[]){ String s1="javatpoint"; String s2="python"; System.out.println("string length is: "+s1.length()); //javatpoint ning uzunligi 10 ga teng System.out.println("string length is: "+s2.length()); //python uzunligi 6 ga teng }} Quyidagi kod ektanga nimani chiqaradi? public class FormatExample{ public static void main(String args[]){ String name="sonoo"; String sf1=String.format("name is %s",name); String sf2=String.format("value is %f",32.33434); String sf3=String.format("value is %32.12f",32.33434); System.out.println(sf1); System.out.println(sf2); System.out.println(sf3); }} Quyidagi kod ektanga nimani chiqaradi? public class SplitExample{ public static void main(String args[]){ String s1="java string split method by dasturchi"; String[] words=s1.split("\\s"); for(String w:words){ System.out.println(w);} }} Quyidagi kod ektanga nimani chiqaradi? public class Test{ public static void main(String args[]){ int a=10; int b=20; int c=25; int d=25; System.out.println("a+b="+(a+b)); System.out.println("a-b="+(a-b)); System.out.println("a*b="+(a*b)); System.out.println("b/a="+(b/a)); System.out.println("b%a="+(b%a)); System.out.println("c%a="+(c%a)); System.out.println("a++="+(a++)); System.out.println("b--="+(a--)); //d++ va ++d lardagi farqlarga etibor bering System.out.println("d++="+(d++)); System.out.println("++d="+(++d)); }} Quyidagi kod ektanga nimani chiqaradi? Download 32.52 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling