Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Small help in Code Construct-

 
typical guy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if(IsProduct)
{

totalProducts = workdesc.getinput().getProducts().sizeofproductarray();
for (int i = 0; i < Products; i++)
{
String code = workdesc.getInput().getProducts()
.getproductArray(i).getStringValue();
Product.add(code.toUpperCase());
}
}
else
{
Product.add(Constants.DEFAULT);
}

If the input coming from the workdesc is of type product is Empty we assigned it to be default from constants(Utils).

As same i have a constant called "EVERYTHING"... I need to enhance the code... the way that

If -elseif-else kind of structure.... where elseif---DEFAULT.......elseif--Everything.....else( throw an exception).

can someone construct the code... Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic