import java.util.Scanner;
/**
* @(#)wefeqwrf.java
*
* wefeqwrf application
*
* @author
* @version 1.00 2013/11/15
*/
public class wefeqwrf {
public static void main(String[] args) {
// TODO, add your application code
Scanner scan= new Scanner(System.in);
String number = "000";
String a;
int count=0;
for(int i=0;a!="-1";i++)
{
for(int k=0;k<3;k++){
a=scan.next();
a.charAt(0)= number.charAt(k);
if(number.equals("110"))
{
System.out.print("Tebrikler!=110");
count++;
}
else
{
System.out.print("Maalesef olmadı:" + number);
}
}
}
}
}
It gives the error:
error: unexpected type at this code: `a.charAt(0)= number.charAt(k);`
how can I assign the content of a to the specified index of number?
and when I changed the string a to the char a scan.next()
does not work why and what can I do is there a any scanner method for char?
String.charAt(int)
is a method that returns the VALUE of the character of the string at the specified point. You can't assign it anything using this methodology. – dataNinja124 Nov 15 '13 at 20:40