import java.util.Scanner;

public class Initials {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);

System.out.println("please enter your first name, middle name and last name");
String FirstName = input.nextLine();
String MiddleInitial = input.nextLine();
String LastName = input.nextLine();
System.out.println ("Your full name is " + FirstName + LastName);
System.out.println("Your full name with initial is " + FirstName + MiddleInitial.CharAt(0)+ LastName+".");
}
}

it says that "MiddleInitial.CharAt(0)" cannot resolve 'charAt' in 'String'. how can I fix it?

*/

public static void main(String[] args) {
Scanner input=new Scanner(System.in);


System.out.println("Enter your first name: ");
String FirstName = input.nextLine();

System.out.println("Enter your last name: ");
String LastName = input.nextLine();

*/

public static void main(String[] args) {
Scanner input=new Scanner(System.in);


System.out.println("Enter your last name: ");

To fix the error "MiddleInitial.CharAt(0) cannot resolve 'charAt' in 'String'", you need to make a correction in your code. In Java, the correct method is "charAt()", not "CharAt()".

Here's the corrected code:

```java
import java.util.Scanner;

public class Initials {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.println("Please enter your first name, middle name, and last name:");
String firstName = input.nextLine();
String middleName = input.nextLine();
String lastName = input.nextLine();

System.out.println("Your full name is " + firstName + " " + middleName + " " + lastName);
System.out.println("Your full name with initials is " + firstName + " " + middleName.charAt(0) + ". " + lastName + ".");
}
}
```

In the corrected code, the correction is made in the line `System.out.println("Your full name with initials is " + firstName + " " + middleName.charAt(0) + ". " + lastName + ".");` by changing `MiddleInitial.CharAt(0)` to `middleName.charAt(0)` to access the first character of the middleName string using the `charAt()` method.