Say I have the following code below that only uses 2 curly brackets:
public void listFish(){
System.out.println(name + " with " + numFishCaught + " fish as follows: ");
for (Fish f: fishCaught)
if (f != null)
System.out.println(f.toString());}
Will it hurt my code or change the way it runs if I rewrite it this way? What is generally the correct way of using curly brackets? Thanks
public void listFish(){
System.out.println(name + " with " + numFishCaught + " fish as follows: ");
for (Fish f: fishCaught){
if (f != null){
System.out.println(f.toString());
}
} }