Java入门总结

2022-01-14  本文已影响0人  Pingouin

根据Udemy的Java教程写的笔记,新手友好。
🔗:https://www.udemy.com/course/learn-java-programming-java-beginners-course/

基础语法

public class name {
          public static void main(String[] args){
                 System.out.println("This is the 2nd instruction that  i have executed");
                 System.out.print("my name is ");
}
}

缩写 psvm tab
缩写 sout tab
缩写 souf tab

operators

arithmetic operators relational operators logical operators assignment operators

concatenation

public class concatenation {
    public static void main(String[] args) {

        int number =10;
        String text = "test";
        double doubleNumber = 11.1;
        float floatNumber = 11.1F;
        boolean truth = true;
        char  c = '*';
        System.out.println("my string vatriable has the value "+text);

        System.out.printf("I have decalred a string variable with the value %s",text);
        System.out.println();
        System.out.printf("I have decalred a int varibale with the value %d",number);
        System.out.println();
        System.out.printf("I have decalred a double varibale %f " +
                "and a string with the value %s", doubleNumber,text);
        System.out.println();
        System.out.printf("We are decalring a boolean %b",truth);

    }
}

char %c
int %d
double %f

equality of two strings

Java is a case sensitve language

.equalsIgnoreCase

上一篇 下一篇

猜你喜欢

热点阅读