Комментарии:
Thank you ma'am, I have been asked this question in interview and I was unable to answer properly, now I am confident on this topic.
ОтветитьMa'am I am having a doubt, starting 4 mins of the video where you said "to access a private method you have to make it static", I didn't get that point. Please explain.
ОтветитьGood Video
ОтветитьNice Video
ОтветитьNice explanation
ОтветитьThe topics you cover here are so unique !!! I have seen many tutorials for Java..... But the type of topics you cover here and the explanation is top notch!!! ❤ Thank you for your efforts 🎉❤
ОтветитьThanks for this crystal Clear Explanantion .
ОтветитьDid u said that u a passing object by value at the end ? When u actually passing the reference!
ОтветитьExcellent
ОтветитьPass By Reference: Changing the value of the real address in the memory.
Pass By Value: Copying the value to another location and so the real value is not changed.(java)
you rock
ОтветитьThank you mam I had understand very clearly but one doubt raised in mind that why java is particularly called pass by value here we are doing both pass by value and pass by reference can you please explain mam?
Ответитьhow to write junit ?
myovject oldermethod()
{
other call//
hashmap map = new hashmap():
NewObj obj = service.myservice(map);
//logic
value = map.get(0); // here i am getting null pointer in junit test
return myobject;
}
class myservice{
NewObj myservice(hashmap map)
{
//logic
map.put(key,value):
return Newobj;
}
}
after that i am getting null if i mock the myservice ...how to write junit for oldermethod()
call by rfrnce vs pass by rfrence same or
dfrnt
Thankyou mam.. for explaning this in a wonderful way
ОтветитьMam im getting really confused with this concept? Please help me to understand
ОтветитьHum value bhi pass kr rhe hai aur object reference bhi pass kr pa rahe hai to java sirf passed by value kyu 🤔?
ОтветитьJAVA IS ALWAYS PASS BY VALUE ALWAYS
ОтветитьThanks 👍
ОтветитьGod bless you mam for your good work…your work really helps people….keep up!!!
Ответитьnice explanation however had a doubt, since java is pass by reference for object as per your example for Animal Object.
i tried the same example with Integer since its an Object, the same was not happening.
Please check the below example.
public static void main(String[] args) {
Integer i = 10;
change(i);
System.out.println("main"+i);//op is 10
}
public static void change(Integer i) {
i =11;
System.out.println("method"+i);//op is 11
}
Best explanation ❤️
ОтветитьSuper 🌟
ОтветитьNeed small clarification, when primitive variable 'a' passed as an argument to a method you said java copies the value of 'a' to a new memory location and that location address passed to that method as argument so value wouldn't update in parent class ? Same theory isn't applicable to objects ? Java doesn't copy the object to different memory location and sends that memory location address to method as an argument ?
ОтветитьToday this question asked by interviwer...I got trapped... there is mutable/immutable thing also matter to this pass by value or reference. Please clear this also.
ОтветитьBest explanation !
ОтветитьNice explanation!
ОтветитьI am unable to understand madam
Ответитьseen many videos from your channel, everything is on point explanation and also the slides are perfect to read even though there is no audio. where can we find all your presentation slides?
ОтветитьSo can we say, java is pass by reference for non-premitive data types?
Ответитьvera level
ОтветитьThe video views is equal to your subscriber count
ОтветитьBest explanation by far
ОтветитьPl make it more clear.
ОтветитьSo we can say reference is passed as value so reference doesn't change but object value gets change in case of passing reference?
ОтветитьIts still not clear to me-
Example 1-
If I just add tempList in my base case then I get [] [] [] [] as and, as it holds the reference and it gets modified in the recursive calls, so at each step when it hits the base case I need to capture the then state of the arraylist and store it in the res.
private static void backtrack(List<List<Integer>> list, List<Integer> tempList, int[] nums, int remain, int start) {
if (start >= nums.length && remain != 0) {
return;
} else if (remain == 0) {
list.add(new ArrayList<>(tempList));--> if I do not make a new list out of it , it gets modified. REFERENCE VAIRABLE THATS WHY!!
} else {
for (int i = start; i < nums.length; i++) {
if (nums[i] > remain) {
break;
}
if ((i > start && nums[i] == nums[i - 1])) {
continue; // skip duplicates
}
tempList.add(nums[i]);
backtrack(list, tempList, nums, remain - nums[i], i + 1);
tempList.remove(tempList.size() - 1);
}
}
}
But in this example, even if I set the prev pointer when my left recurison ends for the first time
,still its value is null when it backtracks-
private void convertBtToDll(Node temp, Node prev) {
if (temp == null) {
return;
}
convertBtToDll(temp.left, prev);
// marks the head -- leftmost node
if (prev == null) {
head = temp;
}
// make the links for the other nodes
else {
temp.left = prev;
prev.right = temp;
}
prev = temp; ----> even if I set it here it is null?????? why? isn't it a reference variable?
convertBtToDll(temp.right, prev);
}
public static void main(String[] args) {
ConvertBTtoDLL2 btToDll = new ConvertBTtoDLL2();
Node root = new Node(10);
root = new Node(10);
root.left = new Node(12);
root.right = new Node(15);
root.left.left = new Node(25);
root.left.right = new Node(30);
root.right.left = new Node(36);
System.out.println("After conversion to DLL");
Node temp = root;
Node prev = null;
btToDll.convertBtToDll(temp, prev);
btToDll.printDll();
}
Real time example is very easy to understand, thank you...
ОтветитьThis is too much of a hindi accent to take in..
ОтветитьThank You for making this video. Need small clarification, when primitive variable 'a' passed as an argument to a method you said java copies the value of 'a' to a new memory location and that location address passed to that method as argument so value wouldn't update in parent class ? Same theory isn't applicable to objects ? Java doesn't copy the object to different memory location and sends that memory location address to method as an argument ?
ОтветитьThis is very helpful video. Thanks a lot for explaining this👍
Ответитьjava is strictly pass-by-value method 'arguments' "value" initializes and assigns newly created method 'parameter'value
Ответитьstill a bit confusing about pass the object as a parameter
ОтветитьIt is perfect explanation. But still, can you please add new video on this with detail explanation and example.
ОтветитьAwesome explanation
ОтветитьThank you so much Ma'm to clearing my Concept... & Congratulations for a new subscriber 😉
ОтветитьYou missed to mention difference between int and animal ...
ОтветитьTHIS IS GR8!!!
ОтветитьYou did an excellent job explaining, thank you so much!! =)
Ответить