Java CommonQuestion
Java CommonQuestion
***************
Discuss the logic of how to reverse a string and check whether string is a valid
palindrome
not sorted
1 -> n
Find missing number in an array
Here, from 1 to 5
{1, 2, 4, 5}
output : 3
*************************
sort an array
*************************
Input : Hello
Output : 2
Input : world
Output : 1
***************
***************
String data = "hello world code";
Solve using map and then without map using two pointer
***************
Two Sum:
Input:
number = {2, 7, 11, 15} , target = 9
Output:
{2, 7}
or
{0, 1} // index
*********************************
int num1 = 12345;
sum of digits of num1 is 15
*********************************
Output : PXrYoZgram
Output : ALBaCptop
*********************************
Print pattern:
11 12 13 14 15
* * * *
31 32 33
* *
51
1 2 3 4 5
* * * *
6 7 8
* *
9
* * * * *
* * * *
* * *
* *
*
11 12 13 14 15
a b c d
31 32 33
a b
51
for input of
int n=23
1 2 3 4 5
* * * * *
11 12 13 14 15
* * * * *
21 22 23
int n=27
1 2 3 4 5
* * * * *
11 12 13 14 15
* * * * *
21 22 23 24 25
* *
*********************************
System.out.println(result);
//OOPs Polymorphism
class Parent{
int val1 = 10;
// Can we do
// System.out.println(obj.val2);
// obj.method2();
}
}
// super keyword -> by default super() parent constructor is called before called
atfirst when any contructor is called
class A {
int a1 = 10;
public void m1(){
System.out.println("m1 ");//1
}s
public A(){
this.m1();
System.out.println("A Constructor");//2
}
}
https://docs.google.com/document/d/1JP27T38JEqZOJcjMWAZU3p03fmcNLHNz1vf4Fr3Ozts/
edit?usp=sharing
class B extends A{
int a1 = 20;
public void m2(){
System.out.println(this.a1);
System.out.println(super.a1);
System.out.println("M2 ");
}
public B(){
System.out.println("B Constructor");//3
}
}
Session
Security
DI, Lifecycle
Thread pool
cross join,
Index, Cluster index non-cluste index which is faster and why
Inmemory authtication
discovery api, reseleance, RequestPart
Difference btw callable and runnable
Thread pool, grouping