I am using a scanner to retrieve from a textfile. When I try to access my info1 from outside of the while loop, it says variable info1 might not have been initialized but I have already initialised it outside of the while loop. how can I access it from outside the while loop with my code?
String info1,info2,info3,info4,info5,info6,info7;
boolean infoTrue = true;
do{ 
while(custInfo.hasNext())
  {
  info1 = custInfo.next();
  info2 = custInfo.next();
  info3 = custInfo.next();
  info4 = custInfo.next();
  info5 = custInfo.next();
  info6 = custInfo.next();
  info7 = custInfo.next(); 
  if(info2== loginID && info3==password)
  {
    infoTrue=false;
  }
  }
 }while(infoTrue!=false);
  System.out.println(info1);
 
     
     
    