package com.Aman;import java.util.Scanner;public class CompareStrings { public static void main(String[] args) { Scanner x = new Scanner(System.in); System.out.println("Enter two strings"); String str1 = x.next(); String str2 = x.next(); // Compare two strings in length int result = str1.compareTo(str2); if(result < 0) { System.out.println("String 1 is shorter than String 2"); } else if(result == 0) { System.out.println("String 1 and String 2 are equal in length"); } else { System.out.println("String 1 is longer than String 2"); } }}import java.util.Scanner;public class Armstrong { public static void main(String[] arg) { int a,arm=0,n,temp; Scanner sc=new Scanner(System.in); System.out.println("Enter a number"); n=sc.nextInt(); temp=n; for( ;n!=0;n/=10 ) { a=n%10; arm=arm+(a*a*a); } if(arm==temp) System.out.println(temp+" is a armstrong number "); else System.out.println(temp+" is not a armstrong number "); }}import java.util.Scanner;public class FloyidsTriangle { public static void main(String[] args){ int n,i,j,k = 1; System.out.println("Enter the number of lines you need in the FloyidsTriangle"); Scanner sc = new Scanner(System.in); n = sc.nextInt(); for(i = 1; i <= n; i++) { for(j=1;j <= i; j++){ System.out.print(" "+k++); } System.out.println(); } }}import java.util.*;public class Lucky_Number { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter the car no:"); int num = sc.nextInt(); if (num < 1 || num > 9999) { System.out.println(num + " is not a valid car number"); } else { int sum = 0; while (num > 0) { sum += num % 10; num /= 10; } if (sum % 3 == 0 sum % 5 == 0 sum % 7 == 0) {
System.out.println("Lucky Number");
} else {
System.out.println("Sorry its not my lucky number");
}
}
}}
package com.Aman;import java.util.Scanner;public class kShapeAlphabets1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int i, j, alphabet; System.out.print("Enter K Shape Alphabets Pattern Rows = "); int rows = sc.nextInt(); System.out.println("Printing K Shape Alphabets Pattern"); for (i = rows - 1; i >= 0; i-- ) { alphabet = 65; for (j = 0 ; j <= i; j++ ) { System.out.print((char)(alphabet + j) + " "); } System.out.println(); } for (i = 1 ; i < rows; i++ ) { alphabet = 65; for (j = 0 ; j <= i; j++ ) { System.out.print((char)(alphabet + j) + " "); } System.out.println(); } }}package com.Aman;import java.util.Scanner;public class Staircase { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Input: n = "); int n = sc.nextInt(); sc.close(); System.out.println("Output: " + countWays(n)); }// Function to count the number of ways to reach nth stair static int countWays(int n){ // base case if(n == 1) return 1; if (n == 2) return 2; return countWays(n - 1) + countWays(n - 2); }}package com.Aman;public class MadamAroraPalidrome { /*public static void main(String[] args) { String str = "madam arora teaches malayalam"; int startIndex = 0; int endIndex = 0; int count = 0; for (int i = 0; i < str.length(); i++) { if (str.charAt(i) != ' ') { startIndex = i; while (i < str.length() && str.charAt(i) != ' ') { i++; } endIndex = i - 1; String subString = str.substring(startIndex, endIndex + 1); if (checkPalindrome(subString)) { System.out.println(subString + " is a palindrome"); count++; } } } System.out.println("Total number of palindromes in given string is: " + count); } public static boolean checkPalindrome(String subString) { int left = 0; int right = subString.length() - 1; while (left <= right) { if (subString.charAt(left) != subString.charAt(right)) { return false; } left++; right--; } return true; }}*/ public static void main(String[] args) { String str = "madam arora teaches malayalam"; String[] words = str.split(" "); for (String a : words) { String c = ""; for (int i = a.length() - 1; i >= 0; i--) { c = c + a.charAt(i); } if (a.equals(c)) { System.out.println(a); } } }}package com.Aman;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 there // is whitespace and store in temp array. String[] temp = pattern.split(str); StringBuilder result = new StringBuilder(); // 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.insert(0, temp[i]); else result.insert(0, " " + temp[i]); } return result.toString(); } // 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)); }}package com.Aman;public class Q1_A4_2 { public static void main(String ... args){ String s ="there is a cat"; char []ch = s.toCharArray(); String[]A=new String[4]; int index = 0; for(int i = 0; i<=ch.length-1;i++) if(ch[i]!=' '){ A[index]=A[index]+ch[i]; }else index++; //static char[] swap(String str, int i, int j) { // char[] ch = str.toCharArray(); //char temp = ch[i]; //ch[i] = ch[j]; //ch[j] = temp; //return ch; // } // public static void main(String[] args) { // String s = "aman"; //System.out.println(swap(s, 5, s.length() - 2)); // System.out.println(swap(s, 0, s.length() - 1)); //System.out.println(s); }}
Java Hyd Team
https://forms.gle/h4bqyzQtGqUk3LR6A FILL THIS FORM FOR TOMMORROWS MASTERCLASS TIMINGS 10AM-3PM WE WILL COVER EVERYTHING FROM SCRATCH TO ADVANCE LEVEL
I will update your calendar so please fill-out this form that will cover most things don't miss it
import java.util.List;
import java.util.stream.Collectors;
import static java.util.stream.DoubleStream.of;
public class Billions{
public static void main(String[] args) {
double a ,b ;
a= System.currentTimeMillis();
List<Double> list = of(1, 1000000000).boxed().collect(Collectors.toList());
list.forEach(System.out::println);
b=System.currentTimeMillis();
System.out.println(b-a);
}
}
import java.util.stream.Collectors;
import static java.util.stream.DoubleStream.of;
public class Billions{
public static void main(String[] args) {
double a ,b ;
a= System.currentTimeMillis();
List<Double> list = of(1, 1000000000).boxed().collect(Collectors.toList());
list.forEach(System.out::println);
b=System.currentTimeMillis();
System.out.println(b-a);
}
}
workplace WITH conflict is likely to succeed over a workplace WITHOUT conflict. Yes, you heard it right.
This is because a workplace WITHOUT conflict will have no diversity of opinion, no creativity, no new ideas, and hence no growth.
A workplace WITH conflict, on the other hand, will succeed, provided it has good conflict management.
I believe that instead of avoiding conflict, one should try to appropriately address and resolve it!
Here are some top-notch ways to manage conflict at workplaces:
1. A lot of conflicts arise out of misunderstandings, and can be prevented and resolved with clear and direct communication at every level. Be an active listener in order to prevent miscommunication.
2. Do not save the conflict resolution for later. The sooner you resolve it, the better. This is because unsolved conflict leads to bitter feelings of distrust, regret, and guilt.
3. There are a few things that would need to be ignored. Prioritize what you can and what you cannot ignore when it comes to conflict.
4. Sometimes, it is better to let others win. If you are engaging in an argument to win or to prove that the other person is wrong, the conflict will only increase, not reduce.
5. Resolve the conflict through face-to-face communication rather than e-mail or social media. Itβs effective because it allows you to read the room and observe the important non-verbal cues from the person and drive the conversation in a better direction.
6. If youβve done something wrong or inappropriate that might have contributed to the conflict, willingly or unwillingly, take accountability and apologize for your actions.
It might be impossible to eliminate workplace conflict altogether, but it is very much possible to resolve it efficiently.
Do you have a story about how you managed a conflict? Share your experience in the comments section.
This is because a workplace WITHOUT conflict will have no diversity of opinion, no creativity, no new ideas, and hence no growth.
A workplace WITH conflict, on the other hand, will succeed, provided it has good conflict management.
I believe that instead of avoiding conflict, one should try to appropriately address and resolve it!
Here are some top-notch ways to manage conflict at workplaces:
1. A lot of conflicts arise out of misunderstandings, and can be prevented and resolved with clear and direct communication at every level. Be an active listener in order to prevent miscommunication.
2. Do not save the conflict resolution for later. The sooner you resolve it, the better. This is because unsolved conflict leads to bitter feelings of distrust, regret, and guilt.
3. There are a few things that would need to be ignored. Prioritize what you can and what you cannot ignore when it comes to conflict.
4. Sometimes, it is better to let others win. If you are engaging in an argument to win or to prove that the other person is wrong, the conflict will only increase, not reduce.
5. Resolve the conflict through face-to-face communication rather than e-mail or social media. Itβs effective because it allows you to read the room and observe the important non-verbal cues from the person and drive the conversation in a better direction.
6. If youβve done something wrong or inappropriate that might have contributed to the conflict, willingly or unwillingly, take accountability and apologize for your actions.
It might be impossible to eliminate workplace conflict altogether, but it is very much possible to resolve it efficiently.
Do you have a story about how you managed a conflict? Share your experience in the comments section.
π1
public class Main {
public static void main(String[] args) {
String s1= "abc";
String s2 = new String("abc");
String s3= "abc";
System.out.println(Integer.toHexString(s1.hashCode()));
System.out.println(Integer.toHexString(s2.hashCode()));
System.out.println(Integer.toHexString(s3.hashCode()));
System.out.println(System.identityHashCode(s1));
System.out.println(System.identityHashCode(s2));
System.out.println(System.identityHashCode(s3));
}
}
public static void main(String[] args) {
String s1= "abc";
String s2 = new String("abc");
String s3= "abc";
System.out.println(Integer.toHexString(s1.hashCode()));
System.out.println(Integer.toHexString(s2.hashCode()));
System.out.println(Integer.toHexString(s3.hashCode()));
System.out.println(System.identityHashCode(s1));
System.out.println(System.identityHashCode(s2));
System.out.println(System.identityHashCode(s3));
}
}