import java.util.*;// import statement for utility packagepublic class Q1_A2 { //class initialization public static void main(String[] args) { // main method allocates memory for the code /project.... Scanner x = new Scanner(System.in); // output Statement String firstString = x.next(); //taking input from user via keyboard String secondString = x.next(); // taking input from user via keyboard System.out.println("Check if the first String and second String is anagram of each other: " + isAnagram(firstString, secondString)); // output Statement } public static boolean isAnagram(String firstString, String secondString) { //methods with inputs parameters char[] firstStringCharArray = firstString.toLowerCase().toCharArray(); // declaring firstStringCharArray a value in lowerCase char[] secondStringCharArray = secondString.toLowerCase().toCharArray(); // declaring secondStringCharArray a value in lowerCase Arrays.sort(firstStringCharArray); // sorting array in ascending order Arrays.sort(secondStringCharArray); // sorting array in ascending order return Arrays.equals(firstStringCharArray, secondStringCharArray); // return statement checks value with the help of .equalsMethod and returns boolean after checking... }}package com.Aman;//add in packagepublic class Q1_A1 { //create class (class doesn't allocates space public static void main(String[] args) { //main method allocates space for the project in heap String inputString = "malayalam"; //declaring and initializing string value int length = inputString.length(); // initializing length with array value length int i, begin, end, middle; // declaring variable in int datatype begin = 0;//initializing variable with value end = length - 1;//initializing variable with value middle = (begin + end) / 2;//initializing variable with value for (i = begin; i <= middle; i++) { // for loop if (inputString.charAt(begin) == inputString.charAt(end)) { //conditional blocks begin++; // post increment after end--; // post decrement after } else { //conditional blocks System.out.println("Not a palindrome.");//output statement break; // breaks statement } } if (i == middle + 1) { //conditional blocks System.out.println("Palindrome."); // output statement } }}import java.io.*;//importing input and output package..public class Q1_A3 { //class declaration public static void main(String[] args) throws IOException { // main method allocates memory for the code /project.... also throwing exception (IOexception).. String ch; // declaring string with a variable BufferedReader br = new BufferedReader(new InputStreamReader(System.in));// we are connecting the BufferedReader stream with the InputStreamReader stream for reading the line by line data from the keyboard. System.out.print("Enter the Statement:"); // output Statement ch = br.readLine();// reading a line of text. int count, len = 0; //declaring dataType do { // loop try { //try -block char[] name =ch.toCharArray();// returns an Array of chars after converting a String into sequence of characters len = name.length; //initializing variable with value... count = 0;//variable initialization for (int j = 0; j < len; j++) { // for loop if((name[0]==name[j]) && ((name[0]>=65 && name[0]<=91)||(name[0]>=97&&name[0]<=123)||(name[0]>=48&&name[0]<=57))) // conditional block count++; // counting and adding in previous value by 1 } if (count != 0) // conditional block System.out.println(name[0] + " " + count + " Times"); // output Statement ch = ch.replace("" + name[0], "");// a new string resulting from replacing all occurrences of old characters in the string with new characters } catch (Exception ignored) { // catch block can't be empty so using ignored keyword } } while (len != 1); //conditional loop }}