Experienced Java interview question | #2

preview_player
Показать описание
Java programming interview questions
Рекомендации по теме
Комментарии
Автор

The answer is: 1 - 0, j value is 0, afterthat i value will be increment by 1...

TNBUS_ADDICTERZ-
Автор

The expression is evaluated first with the current value of the variable in which the post increment is used then after that it is incremented .

tekamanurag
Автор

1-o is the write answer because i value is increasce after i and j get add so that j=i++ +j the j=0 and i become1.

asmit
Автор

The initial value of i is 0.
j is initially set to 0.
After the expression j = i++ + j, i becomes 1 and j remains 0.
The final output is 1 - 0.

usmanahmadkhan
Автор

1-0 because i+ + means =i+1 i=0 increment +1 = 0+1=1. And j = 0 only + 0+0=0 answer 1-0

DebadityaBarai
Автор

It's 1-0 since in post incrementation, before incrementing i, you first need to evaluate the whole expression; therefore first adding i (0) and j (0), then i will be incremented. Meaning, only after assigning 0+0 to j will i be incremented.

NeoTechVision
Автор

Post incrementation, j = 0 + 0 then print(i or (0+1) + "-" + 0) so yup it is 1-0 mate, basics

archanamishra
Автор

Hello sir, I am one of your oldest subscriber.. Can you please make a video on career progression of a java developer?? Like after 8 9 years what happens?

honeybunny
Автор

First to print i
I value be intitaliased as 0 so I is 1
j =1+0=I++ + j=1
So answer is option c 0-1

j.jeyrengarajendiran
Автор

1-0 but first i thought its 0-0 but after giving five minutes to this question i got answer.

vpgoylc
Автор

I cannot understand sir. Could you please tell me why it will be answer was 1-0

karthigamingff
Автор

1.i=0
2.j=0
3.j=0+0 => j = 0 as i is post incremented
4.now i=1
Output is 1-0

shilpabarnawalbaarnawal
Автор

1-0 is the answer
because j=0+0 and i is incremented so i =1🎉

_lisaroy
Автор

1-0 is correct answer j=0 and i=1 when after increament it will become 1

fmslzee
Автор

1-0
Because the other variable doesn't actually change

asagiai
Автор

i think 0-1
reason for
int i=0;// i value zero that assign
and then j=i;//i value is zero
j=0;
j=i++(increament operator)+j;
then can be assin i valuei zero and known i value is one ;
j=1+0;
j=1;// j value is assign in one
now print value is i is zero and j is one
i+"-"+j=0-1from output

_GT__
Автор

1-0 is correct answer cause value of j is assigned 0 first then program control perform addition by adding 1+0 then print the value of i and j

Amittt
Автор

1-0
This is because the expression i++ increments the value of i after using its original value in the operation. Therefore, i becomes 1, and j retains its original value of 0.

aashishchaudhary
Автор

1-0 option is correct.
Decribe I++ value is 1 and +j is do not increment the value so 0.
Second option .

nnvngmf
Автор

1 - 0 because i is post incremented and j is pre incremented

sumedhtayade