java - Two Dimensional Array -


i having troubles "for" loop in program. main error getting "type mismatch: cannot convert int boolean." want have corresponding "time" element printed out. know conditions need of type bool "classnames[0].length", can't figure out how that. thanks!

    import javax.swing.joptionpane; import java.util.scanner;  public class arraytest { public static void main(string[] args) {      int = 0;     string classinput;      string[][] classnames = {               {"cis 280", "acc 212", "his 300"},               {"tue 7:30", "thu 2:30", "fri 1:00" }             };   classinput = joptionpane.showinputdialog("please input class name: ");   (i = 0; classnames[0].length; ++i) // problem line    if(classnames[0][i].equals(classinput))     {        system.out.println("class time:" + classnames[1][i]);     } } 

}

you wanted compare i classnames[0].length provide necessary boolean argument. providing classnames[0].length int.

for (i = 0; < classnames[0].length; ++i) 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -