Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Why am i getting error with System.out.println?

class StringDemo {
   public static void main(String[]args) {
      String str = new String("hello");
      System.out.println(str+1+2+3);
      System.out.println(1+str+2+3);
      System.out.println(1+2+3+str);
      System.out.println((1+2)+str+3);
      System.out.println(1+str+(2+3));
   }
}

why am I getting an error?


0 Answer
Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.