0
System.exit( )
what is System.exit( ) method? I seen example code: class program{ public static void main(String[ ] args){ int x=0; System.exit(); System.out.println(“1”); }} Here output is : error How does it work....
5 Antworten
+ 2
Indian
Yes. If a method expects arguments than you have to use them when calling this method.
+ 4
Hello Indian
int x = 0;
int not Int
System.exit() expects an integer as argument.
Normal exit: System.exit(0);
About this method: https://www.baeldung.com/java-system-exit
System.out.println("1") vs. System.out.println(“1”);
It is hard to see but in your code you are not using the normal "".
Your code uses this characters: \u201c and \u201d so you get an illegal character error.
Btw: Because of the exit your last print statement is dead code.
0
thank you😊 Denise Roßberg
and it is compulsary to pass integer argument in System.exit( ) ?
without we get error ryt...
0
tq Mirielle