Question: 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);

```

Answer: 
```
String info1,info2,info3,info4,info5,info6,info7;

```

Above line should be:

```
String info1="",info2="",info3="",info4="",info5="",info6="",info7="";

```
According to your code, you have two while loops, probably you might have initialized it inside first while loop, but you are accessing it outside both loops. Hence make sure you have initialized it outside both loops.

```
String info="";
do{
    while{
    }
while();
Sysout(info);

```

Also put a break point and see where it is going !