I am getting the error in Java:
Exception in thread "main" java.lang.Error: Unresolved compilation problem
The local variable b1 may not have been initialized at Test.main(Test.java:20)
Here is my code:
import java.lang.String;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
char a[]={'s','k'};
String s0=new String(a);
String s1=new String("Amar");
String s2= "amarnath";
byte[] b1;
try{
b1=s2.getBytes("ASCII");
}
catch(Exception e){}
for(int i =0;i<s2.length();i++)
{
System.out.println(b1[i]);
}
}
}