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
HAPPY SARASWATI PUJA 😊
1
Hi all pls attend class tomorrow
Kannababu sir asked me 2 take class
Message from srinivas sir so if you are all available do join the session and some projects 🙂
// Wjp to count the no. of characters in given array I/P :- satgya O/P :- s= 1 a= 2 T = 1 h= 1 y=1


public class CountCharacter {

public static void main(String[] args) {

String str = "12345613245";

int count[] = new int[256];

int len = str.length();

for (int i = 0; i < len; i++)
count[str.charAt(i)]++;

char ch[] = new char[str.length()];
for (int i = 0; i < len; i++) {
ch[i] = str.charAt(i);
int find = 0;
for (int j = 0; j <= i; j++) {

// If any matches found
if (str.charAt(i) == ch[j])
find++;
}

if (find == 1)
System.out.println(str.charAt(i) + " =" + count[str.charAt(i)]);
}
}
}
👍1
public class ReverseWordsInSentence {
public static void main(String[] args) {
String sentence = "which is the biggest continent";
String[] words = sentence.split(" ");
String reversedSentence = "";
for (int i = 0; i < words.length; i++) {
String word = words[i];
String reversedWord = "";
for (int j = word.length() - 1; j >= 0; j--) {
reversedWord = reversedWord + word.charAt(j);
}
reversedSentence = reversedSentence + reversedWord + " ";
}
System.out.println(reversedSentence);
}
}
public class LargestNumber {
public static void main(String[] args) {
int N = 139;
int D = 3;

int L = 0;

for (int i = N - 1; i >= 0; i--) {
String number = String.valueOf(i);
if (!number.contains(String.valueOf(D))) {
L = i;
break;
}
}

System.out.println("Largest number less than " + N +
" and not containing " + D + " is " + L);
}
}
👍1
public class BiggestNumber {

public static void main(String[] args) {

int a = 50, b = 20, c = 40;

if (a > b && a > c)
System.out.println("a is Biggest number");
else if (b > c)
System.out.println("b is Biggest number");
else
System.out.println("c is Biggest number");
}
}
public class DuplicateElementsInArray {
public static void main(String[] args) {
//Initialize array
int [] arr = new int [] {1, 2, 3, 4, 2, 7, 8, 8, 3};
System.out.println("Duplicate elements in given array: ");
//Searches for duplicate element
for(int i = 0; i < arr.length; i++) {
for(int j = i + 1; j < arr.length; j++) {
if(arr[i] == arr[j])
System.out.println(arr[j]);
}
}
}
}
Java Hyd Team
public class DuplicateElementsInArray { public static void main(String[] args) { //Initialize array int [] arr = new int [] {1, 2, 3, 4, 2, 7, 8, 8, 3}; System.out.println("Duplicate elements in given array: "); …
public class DuplicateFinder {
public static void main(String[] args) {
int[] arr = {1,2,3,4,5,3,4,7};
for (int i = 0; i < arr.length; i++) {
int element = arr[i];
boolean found = false;
for (int j = 0; j < i; j++) {
found = (arr[i] == arr[j]) ? true : false;
if (found) {
System.out.println("Duplicate element: " + element);
break;
}
}
}
}
}

Same question using ternary operator
Get ready with strings concepts , jsp.
Interface , abstract class
Conceptual knowledge on above topics and also exception handling