Question 1. I was reading a Java book
if(min>v) = min = x;
I thought about a line of code, but I don't know why you skipped {} instead of if(min>v) {min=x};
.
Question 2.
invite (new ArrayList<String>() { { add("Harry"); add("Tony"); } } )
As far as I know, when using the anonymous class, use {}
only once to describe the method and data inside.
However, I don't understand why the above code used {}
#2{}
.
Please give me a good answer.
java
© 2024 OneMinuteCode. All rights reserved.