Java Hyd Team
746 subscribers
986 photos
39 videos
670 files
690 links
https://teamhydteam.my.canva.site/

Can visit us on our website 😊
Still working on it 😊
Download Telegram
Java bean class 😊
Configuration file (.XML file )
Setter injection
Test class
Constructor injection
Sony is Hiring Machine learning Intern
Role - Machine learning Intern
Experience: Student/fresher
Salary - 40k - 50k per month
Passout year - 2024,2023 ,2022
Qualification: Btech/BE/Mtech/MCA
Location: Work from home


Apply now: https://www.linkedin.com/jobs/view/3352394311
Java Hyd Team
import java.util.Scanner; class ReverseWords { static void reverseWords(String str) { String[] arr = str.split("\\s"); for (int i = arr.length-1; i >= 0; i--) { Sy…
package com.Aman;
import java.util.*;
import java.util.regex.Pattern;
public class Q1_A4 {
// Java Program to reverse a String
// without using inbuilt String function
// Method to reverse words of a String
static String reverseWords(String str) {
// Specifying the pattern to be searched
Pattern pattern = Pattern.compile("\\s");
// splitting String str with a pattern
// (i.e )splitting the string whenever their
// is whitespace and store in temp array.
String[] temp = pattern.split(str);
String result = "";
// Iterate over the temp array and store
// the string in reverse order.
for (int i = 0; i < temp.length; i++) {
if (i == temp.length - 1)
result = temp[i] + result;
else
result = " " + temp[i] + result;
}
return result;
}
// Driver methods to test above method
public static void main(String[] args) {
String s1 = "There is a Cat";
System.out.println(reverseWords(s1));

String s2 = " Cat is there";
System.out.println(reverseWords(s2));
}
}
updated new answer correct
import java.util.*;
// import statement for utility package
public 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 package
public 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
}
}
}