Java: conditional initialization?
- by HH
Ruby has conditional initialization. Apparently, Java does not or does it? I try to write more succintly, to limit the range as small as possible.
import java.io.*;
import java.util.*;
public class InitFor{
public static void main(String[] args){
for(int i=7,k=999;i+((String h="hello").size())<10;i++){}
System.out.println("It should be: hello = "+h);
}
}
Errors
Press ENTER or type command to continue
InitFor.java:8: ')' expected
for(int i=7,k=999;i+((String h="hello").size())<10;i++){}
^