Morgan Stanley | Java spring boot microservice | Video Interview

preview_player
Показать описание
#javainterviewquestion #ola #springboot
Microservice
Springboot
Java 8

Real time interview:

real time interview questions and answer
Рекомендации по теме
Комментарии
Автор

I think you told read has a lock in concurrent hashmap that's not true, we have lock only on write operations. 😊, Great job for this video really appreciate.

soulfulGirl_
Автор

Programing:

import java.util.ArrayList;
import java.util.List;

public class {

public static void main(String[] args) {
List input1 = new ArrayList<>();
input1.add("A");
input1.add("B");
input1.add("C");
input1.add("D");
input1.add("E");

List<String> input2 = new ArrayList<>();
input2.add("1");
input2.add("2");
input2.add("3");
input2.add("4");
input2.add("5");

Operations operations = new Operations();

AlphabeticThread alphabeticThread = new AlphabeticThread(operations, input1);
Thread alphThread = new Thread(alphabeticThread);
alphThread.start();

NumberThread numberThread = new NumberThread(operations, input2);
Thread numThread = new Thread(numberThread);
numThread.start();
}
}

class AlphabeticThread implements Runnable
{
Operations operations;
List<String> input1;
AlphabeticThread(Operations operations, List<String> input1)
{
this.operations = operations;
this.input1 = input1;
}

@Override
public void run() {
synchronized (operations)
{
for(String s: input1) {
operations.updateRecord(s);
try {
operations.wait();
operations.notify();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}

class NumberThread implements Runnable
{
Operations operations;
List<String> input2;
NumberThread(Operations operations, List<String> input2)
{
this.operations = operations;
this.input2 = input2;
}
@Override
public void run() {
synchronized (operations)
{
for(String s: input2) {
operations.updateRecord(s);
operations.notify();
try {
operations.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}

class Operations
{

public void updateRecord(String output)
{
System.out.println(output);
}
}

mahi
Автор

Thank you bro....Excellent its really helpful keep posting 👌👌

punyabikash
Автор

Were you talking about vert.x??? Did you add this in your resume??

murahariraofam
Автор

How many rounds in Morgan Stanley? I have less knowledge about DSA part so please suggest how to prepare the interview

mahaperumal
Автор

32:50 you need to use wait and notify method in this scenario

gulfamhassan
Автор

Hi..
In cognizant what will be the package for Sr Software Engineer B2 position?

syedmohsin
Автор

At the time of interview, how much experience do you have ?

abhaykumar-tkxr
Автор

Thread sleep wont be helpful here, because My Requirement is different here, should go for wait and notify only

sarojsahoo
Автор

LibraryMangament system works well using concurrent hash map if you have hash key on starting letter of book name...if multiple theards tries to read and update rack info at a time so it will give error. just think about hash value.

mahi