Java Developer Interview

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 21

okay what is springboard

spring boot actually uh spring boot is a

framework which which is a base on top

of the

spring framework basically spring boot

has like a lot of features basically the

like it is like we can create a

standalone standalone application it is

a kind of rapid application development

platform

and like it comes with an auto

configuration features like even if you

are talking about the spring and we see

there is a spring boot nvc which comes

with like uh it has a auto in

in-built thin leap support for it so

yeah we can create a rapid application

it contained uh like inside uh like uh

what embedded embedded servers so there

are three type of servers are there the

tomcat is the default one other than

there is a gt server is there under 2 is

there and we are free to choose which

server we can which whichever servers we

can use for it so yeah and also and you

can even like create a production ready

app using springboard uh

yeah

and yeah okay

so like we are like we are the spring in


the spring but it comes with some

starter dependency so there are every

starter dependency at its its own like a

work basically there are a lot of

starter dependencies

so that's okay

if i want to use some other

application server

[Music]

so for using that we do so as i told you

that spring

tomcat is the default one

so first we need to uh like uh we need

to remove it from the dependency so like

in the in the like starter dependency we

can exclude it uh and then we can add a

new server so

that is it

what configuration so

first of all we need to like uh disable

default default server from the

springboard application

and even how there is okay so we have

some uh shutter weight dependency right

inside that there is a tomcat uh

like so we need to exclude that uh from

the dependency so we have to exclusions

tab and using that we can exclude the

tomcat uh dependency
and then we can add a new one using uh

like we can add a new dependency over

there

okay

what is the difference in controller and

rest controller

controller and rich controller basically

controller annotation is comes in the

context of the spring mvc this

controller is comes in the context of

when you are or you want to create and

these services so controller uh rest

control is nothing but the rest control

is nothing but the formation of

controller plus response body and if you

if you are using risk controller then it

will you are enabled to you can fully to

use the hydraulic gate either exposed at

the right boot i direct patch and delete

delete annotation so yeah

[Music]

you are writing services for customers

right

yeah so can i write to you on the chat

so yeah if slash customers give you the

list of customers slash customers

uh customer id which retrieving the

like particular customers are customers

so that

if you are you're doing the put


operation on that second endpoint it

will uh update it you can even update

the particular customer using that the

second one second second uh

second endpoint anyone you can delete

that customer using the second endpoint

first one first one is like if we are

using get operation on that endpoint it

will return the list of customers and if

you are doing the post operation on this

endpoint it will add new resources on

the server basically adding new

customers

basically gate is something so if if you

are like technically uh basically if you

are calling the get method again

hundreds of times it will not affecting

your server rather than if you are if

you are calling post it will it will

repeatedly creating new resources on the

server so basically uh

and uh yeah so like gate is something

called getting the operation pushes uh

if you want to add any new resources on

the server in that can use a push method

okay how how data get passed

yeah

yeah in in the gate in the gate data is

passing the url parameter in the post


the data is passed in the request body

basically

okay

what do you use 1.8

what are the new features yeah

java 1.8 is actually comes with a lot of

features or starting from polish loop

uh starting for porridge loop so we can

use the polish loop for

one collection that is one feature

second is a stream api introduced in

java

which i use a lot of time

third one is a function interface also

introduced in java functional interface

uh lambda lambda expression is also

introduced in java 8 optional classes

also electronics in java

then

the interface enhancement has been done

in the java like adding new there are

two new method and producing java in the

interface depot and static

and collector class

and apart from that which is nice or not

i used i think nystrom may be something

javascript engine uh which i've

introduced and date and time api which i

am

making or not
um

memory uh in memory level is there any

stack overflow in java have you seen yes

most of the time i have seen the stack

overflowing

but

most of the time i have seen that

stack over

what is

sometimes like whenever we are trying

like

whenever the like

we say

i don't know the exact answer for the

time but yeah i've seen that here

okay uh

have you have you configured size in

java yes uh if size can be configured

using you can even configure in the like

basically whenever we are like uh

deploying the enterprise application

and that time like we are passing in the

command terminal like uh like for docker

even for docker deployment that time we

are passing in the command command

deployment platform so and initially

like previously we are normally we are

doing the project in our place and we

are transferring that project to the


other space so

that will sometimes what happen uh this

will create a like problem

even in the case of

any dependencies like like if any

dependencies are missing so docker is

like is a way of like deploying your

application even you can deploy your

application on docker it will create an

image and even you can just push that

image to the

remote uh repository that is one of the

example is a docker hub

so yeah it's a kind of they're like uh

you can create an image

if you want to create a docker docker

image how can you create so for that we

need to create a docker file which

without extension docker file and then

we need to write some logic over there

not a logic basically just writing some

syntax are there like which image you

want to use java versions and then we

need to like uh

mention the file name file path and then

we in at the last we need to provide an

entry point entry pointer

sorry

uh he's saying the

kubernetes yeah yeah no kubernetes so


kubernetes is also like it's a google

platform so it's

one of the best one so google natives

actually it's like uh

let's see so it rules the docker image

and what the hell that what is the

feature of coupon what hello

hello

go ahead okay sorry

i think okay so cooper nature is what we

say

like a very like simple way to like

automatically we can say automatically

deploy automatically scale

so like it's kind of platform and it

will like uh like like so smallest

concept in the kubernetes is a power

basically or is kind of like in a simple

language it's like just like a system so

you can create a replica of your pod and

you can deploy your project on that

things so yeah

okay

and uh how you deploy on a google

platform

google platform so yeah so you know yeah

in our current project they are

deploying in uh like basically they are

creating docker images and they are


deployed that docker image and cobra

native so basically

but the deployment so if you are asking

the deployment so sorry but deployed so

we are working in agility there is one

member of devops person so we and like

so

he handles that

but yeah we are like definitely we

ultimately have to work in group

so yeah

okay

what is different between uh

normal power loop and stream apis to be

porridge uh normal for so stream api is

complete they do kind of shrimp

basically sequential and parallel stream

uh the for loop

they it it's like it's internally like

for loop forage loop like it's using the

lambda expression

inside that forward loop we can pass

like

this i'm not getting the context of the

question

no

i know there might be something which

you have now

say

if if i want to create a
set

okay okay but yeah but uh my order

should be maintained

okay what which collection

so if you want to like use this set and

in which order so there's a like

there is a special set is there uh let

me think about it i know i know i

know about it or

headset reset and then uh

insertion on maintain insertion order

say there is one set let just give me

one second i think

increase it

with i think i think like

lingard has said maybe linker

it's a part of collection framework it

is a child of uh collection interface

so you uh like uh we can say that um

like

it is a part of java util so

uh

there is like q means uh like it is a

kind of determination which like uh

q is like a one we will say uh

first fifo right first in first out kind

of thing

is there

uh
yeah

fifo is there like first in first out

and what is that

what is

stack stack you know stack yes i know

the stack stack is citing uh exactly

opposite

last in first out

okay exactly

i'm not sure i'm not sure which

okay no problem

yeah

uh

you know you know dynamic binding

uh dynamic polymorphism are you talking

about yeah okay yeah dynamic yeah yes

yes i know you can run time

polymorphism so it's like for runtime

polymorphism we can say dynamic

polymorphism so for that we need one uh

parent class one child class which

having two classes containing same

method same name uh same return type and

same number of parameters that is called

a dynamic polymorphism you can see

then what is the dynamic it is a simple

polymer no no no no no later an example

of if uh like give me an example yeah

sure

okay
so if if you if there's a parent if

there is a child okay and let's take an

example of parent class having some

method uh which child curse doesn't have

this method okay

and like and if you are calling that

method uh using the pattern transition

it will accessible so like uh can you

give the example of that

currently equal to new child

parent class

has some

hello method

and child class

doesn't have that method

so he can like uh child can use that a

method so yeah so we can call this p dot

hello it is possible this is kind of

dynamic polymorphism we can say on

uh i think that parent class equal to

hello you said no that is that is wrong

no no hello is the method actually hello

is the method in the this is method is

present inside the parent class

so

but inside the parent there is a method

hello which is not present in the child

class so we still accessible uh using

that hello
like that

if you want to like i can write on the

full code if you want

let me let me write it down otherwise uh

it becomes okay

no problem okay

uh

no java is too much yeah

we cannot say that

yeah but yeah definitely i'm working

with the cross technology so like it is

difficult to like uh

keep tracking all these things

even

okay so

you can ask me the question related to

episode so i have a good knowledge of

that

no i don't know

okay

what are functional interfaces

functional interfaces are the interfaces

which containing only one abstract

method but it might be contain the

number of default and static method uh

so it must be having one abstract method

so though we can either and there is

annotation function interface which is

not mandatory one you can uh like it is

depending on us
second we can implement that function

interfaces using uh

using lambda expression if you want that

example i will give you

no no what is the benefit of that um

notation

annotation annotation like

so it is not mandatory one the

annotation is not mandatory so like even

if you are creating interface without

with only with creating only one

abstract method that will be fine for

you i think

yeah

so yeah but but what is what is the

benefit of annotation

uh annotation is like mentioning uh

annotation i'm not

like annotation annotate it right right

using function interface so the special

special meaning of both annotation i am

not uh

no so that is okay but if you mark

that

method as a functional interface

sorry that class has functional uh

so it will focus

okay if you're good at checking compile

time that will be yeah but


that is okay but you you suppose you

left that organization somebody has came

to

work on that and yeah i had some

interface or some method

in that okay absolutely right and that

that is that is

that you should mark that okay okay so

that nobody other will

uh work on that or add any area right

any

abstracted

what are best practices of web service

uh what are the best practices of

web services web services or micro

services web services

so both web services and like

microservices both are relay on the http

protocol basically so the

the what we say the

uh the like uh

uri is the most important thing so we

need to like properly like either even

in the the example of customers

so that is the best practices if we are

like we need to properly uh like map

with the like these urls so urls is a

like in the in the in the response in

the website

is the most important part so yeah we


need to like uh

we should be like uh

give the proper noun for it like

properly

uh map with

map with this noun

so that is one thing second thing yeah

if you are talking about the core

practices so code uh so any any code so

if you are talking about the

microservices microservices as as per

name the it is a services with a small

services so while you breaking down your

application into small small component

you make sure that it like it should be

like uh it should be like

we can say independent from each other

and yeah uh that is one thing and in the

if you're talking about the core

standard so we need to like um like code

standard so i personally maintain like

i'm not creating like big methods

basically i'm i'm trying to maintain the

small methods even like like like 10 15

lines of methods max to max that is

maximum

and like there is a code beauty file is

there so like it is it uh already like

uh while compiling it will showing the


error if we are not properly doing the

code like properly writing the code

you mean to say you should your

service should return status

service service service will return the

proper status and one thing one more

thing that service will not return any

kind of like uh

like

we can say

not a secret but uh like

the important data which are which are

like even like let's take an example of

if your services might be written your

your this is my this is this is so your

database is down and it's it might be

returning any kind of uh like your

this database url so that kind of

response is not good thing to

get back in the response so we need to

write down some proper responses proper

we need to map with the proper error

resource responses

so that should be taken care by the app

like the api developer

okay have you validated your data

in my list

oh valid it means i'm not uh

like

validate means
suppose some form is submitted okay

and on server side how you validate that

the data is correct

which

which need to

process further so we are like uh what

we are like we are doing uh

say

uh

we are like uh there is like a

cross-site scripting we are writing some

uh some we are writing some methods

which are like uh uh in which the data

should be passed and the data should be

checked but yeah

if you are asking the in our

architecture basically in our

architecture they are using a pc so in

the apg we have some policies like xml

protection and json protection uh which

are actually this the the all this is

taken care by the apg so if someone try

to send some malicious request or even

some database configuration in the

request it will it will uh stop there

from the going to the backend services

so that is one way but if you are asking

this how we can doing this in uh like

our my upper micro services so in our


project it is not mandatory as it is

covered in rpg but we can uh like uh we

can

what we say

filter the things filter the input

whatever we get using like

specialized

cross

site scripting things

so suppose i i'm submitting some one

form say customer okay i'm taking data

of customer first name last name

database and so and so okay

what how can i validate that data

uh

in any special way

but but hi but that is dependent on uh

in which technology you are like working

springboard or core java applications

so spring boot

we can create a custom annotation to

validate the data basically there are

features some we can even and even like

if you are dealing with bins uh

basically beans so we can even provide

the inside of bin also we can provide

that i direct required annotation and

yeah not empty not blank

yeah i have just wanted to uh hear that

okay sorry so that is good


it's a

i haven't validated

generally okay okay

[Music]

um

you know

is a kind of thing uh which we can

dynamically if you are saving something

it will dynamically like compile and run

in the spring code application

so it quick

quickly like a

running application while compiling

sorry

so in the spring boot we have some using

spring data jp basically for that spring

data gpa so for that number one we need

to add that dependence number two we

need to open the application called

properties or application.yaml files

we need to write some configuration

configuration so configuration is like

that url

you need to write some loading some

driver classes

loading rival classes and getting

connection in travel management

connection and then yeah in this case

private platform using classroom yes


what it does actually it will load it

will register the classes basically load

the classes and

uh load the classes even in the

reflection api there they're also like

this is meteorite loading the classes

clustered for me

[Music]

yes or no yes yes

so what do you think in which like

section i'm you think that i am weak so

you can i can keep it definitely after

this call

no

um

thank you thank you

[Music]

you

You might also like