jeudi 22 février 2018

Loop overr array Java

I want to learn how to write a code that returns the first two numbers of an integer and then returns the remaining numbers. I think it should look like this but I can't seem to find how to write it properly.

char productCode = Keyboard.readCharLN();
char productCategory = productCode.charAT(0);

if (productCode == '1')
    System.out.println ("Msg 1");
else 
    System.out.print ("Msg Err");

char productItem = productCode.charAT(1);
if (productCode == '1')
    System.out.println ("Msg 2");
else 
    System.out.print ("Msg Err");

char productNbr = productCode.charAT(2 to 6);
if (productCode == '1')
    System.out.println ("Numbers from 3rd integer to last")
//I want to print the remaining numbers          

Aucun commentaire:

Enregistrer un commentaire