Hi Naveen, Thanks for spending so much time while creating the knowledge. I am still in doubt on immutability, to me, it seems every variable is immutable: String s1 = "Java"; String s2 = "Java"; String s3 = s1; s3 = "NewJava"; System.out.println(s1); System.out.println(s2); System.out.println(s3); System.out.println(s1); int i1 = 10; int i2 = i1; i2=20; System.out.println(i1); Integer i3 = 30; int i4 = i3; i4 = 40; System.out.println(i3);
Hi, I doubt Why strings are called immutable, because if give like this String s="hi" and in the next line, we give s="hello" the value of s will change right please help me to understand anyone.
It would be great to see more code examples, specially tricky ones. There is 20 minutes of explanation with simple examples but some questions on tests are much trickier and students still fall into the trap.
I don't want to start some East-Coast/West-Coast Gangster Rap War here, but I did notice something. On the answer given by Naresh i Technologies channel here on RUclips, they emphasize very much something that you don't, and mention these only in passing. Some viewers angrily suggested that the "Real Reasons" were what you show here. However, while everything in here is true, I think there is a second reason that was there from the very beginning and became even more important over time and is what is emphasized by Hari Krishna in his video: Suitability of the very common data types of Sting/Integer/other wrapper classes as keys in Hashtable objects, and later HashMap objects, and also later members of SortedSet/NavigableSet or keys of SortedMap objects. His presentation suggests that this was primary and the other things all good, but came later. Anyway, you do highlight why final is necessary for these classes even tho there are plenty of times one wishes one could subclass them for legitimate and honorable purposes, the security danger is too great. Cheers.
Awesome Video , Can you please make one video on this program -> "You are given an array of 0s and 1s in random order. Segregate 0s on left side and 1s on right side of the array. Traverse array only once". I encountered this question in of the interviews I gave. Thanks in Advance
public class segregate { public static void main(String[] args) { // TODO Auto-generSated method stub int arr[] = {1,0,0,1,0,1,0,0,1,0,1}; System.out.println(arr.length); int j = -1; for (int i = 0; i < arr.length; i++) { // if number is smaller than 1 // then swap it with j-th number if (arr[i] < 1) { j++; int temp = arr[j]; arr[j] = arr[i]; arr[i] = temp; } } System.out.println(""); for(int m=0;m
arr = [1,0,0,0,1,1] d = {} for i in arr: d[i] = d.get(i,[]) + [i] new_arr = [] if 0 in d: for i in range(len(d[0])): new_arr +=[0] if 1 in d: for i in range(len(d[1])): new_arr+=[1] print(new_arr)
my question is regarding Xpath ... as u said in drop down session like By.id() in main()... but wen v separately save xpaths in .propertiesfile and wen v want to automate that through keywords.java class den how to use it ... public void choose(String objectname, String data) { Select select = new Select(driver.findElement(By.xpath(prop.getProperty(objectname)))); select.selectByVisibleText("working"); // ??? } leadstatus= //*[@id='23:3372;a']/div/a dis is how i saved in objectrepository.propertiesfile ???
sorry to be so offtopic but does anybody know of a way to get back into an Instagram account? I was dumb forgot the login password. I would appreciate any tricks you can offer me.
@Randall William thanks for your reply. I got to the site through google and im trying it out now. I see it takes a while so I will reply here later with my results.
Hi Naveen, thanks for your helpful videos. If for an example String s="abc"; s=s.concat("def"); System.out.println(s); O/p: abc def So string value got changed. Could you please explain string is immutable concept using the above example
After concatenate new object("abcdef") is created. Now s will refer to new object rather than old object("abc"). Old object is not changed and is no more referred by reference(s).
S1 will not change if S2 value is changed package com.basics.packageone; public class pkg_1_n12_stringTest { public static void main(String[] args) { // TODO Auto-generated method stub String v1 = "Hai"; System.out.println("V1 is " + v1); String v2 = "Hai"; System.out.println("v2 is " + v2); v2 = "Bye"; System.out.println("V2 after change is " + v2); System.out.println("V1 after change is " + v1); } }
Note: From Java 7 onwards, the Java String Pool is stored in the Heap space.
thanks for your time naveen...we r very much thankful towards your work
This is the best explanation. Nobody can match you. Thanks
Hi Naveen,
Thanks for spending so much time while creating the knowledge.
I am still in doubt on immutability, to me, it seems every variable is immutable:
String s1 = "Java";
String s2 = "Java";
String s3 = s1;
s3 = "NewJava";
System.out.println(s1);
System.out.println(s2);
System.out.println(s3);
System.out.println(s1);
int i1 = 10;
int i2 = i1;
i2=20;
System.out.println(i1);
Integer i3 = 30;
int i4 = i3;
i4 = 40;
System.out.println(i3);
String constant pool is in heap area.
Important note: Java String Constant Pool is created inside Heap area.
Thanks Naveen for sharing. God bless you.
Hi Naveen ,
Can you make video on Role & Responsibility of tester in AWS cloud computing. much needed
Excellent explanation Naveen bro
Hi, I doubt Why strings are called immutable, because if give like this String s="hi" and in the next line, we give s="hello" the value of s will change right please help me to understand anyone.
It would be great to see more code examples, specially tricky ones. There is 20 minutes of explanation with simple examples but some questions on tests are much trickier and students still fall into the trap.
Can you please give me the Java tutor for Selenium that you have in your video. Couldn't find the right link.
Thanks
what happen when we declare like
String s = new String("tejas");
String s1 = new String("toley");
is the ref. stored in heap memory?
I don't want to start some East-Coast/West-Coast Gangster Rap War here, but I did notice something. On the answer given by Naresh i Technologies channel here on RUclips, they emphasize very much something that you don't, and mention these only in passing. Some viewers angrily suggested that the "Real Reasons" were what you show here. However, while everything in here is true, I think there is a second reason that was there from the very beginning and became even more important over time and is what is emphasized by Hari Krishna in his video:
Suitability of the very common data types of Sting/Integer/other wrapper classes as keys in Hashtable objects, and later HashMap objects, and also later members of SortedSet/NavigableSet or keys of SortedMap objects. His presentation suggests that this was primary and the other things all good, but came later. Anyway, you do highlight why final is necessary for these classes even tho there are plenty of times one wishes one could subclass them for legitimate and honorable purposes, the security danger is too great. Cheers.
I need ur full videos of java
How can I have live chat with you to discuss about selenium/java If I became the member of this?
one confusion sir
immutable String value are change value or not change
Hi naveen anna, can u make any videos on selenium with c# atleast some advanced videos like framework level
Hi Naveen
My question is how to add firepath, firebug in latest mozila 'Quantum'
I dont think there is a way except downgrading your firefox to the 46-49 versions.
I think chropath for Firefox would help you if you are working with latest version
Hi naveen please make some videos on protractor, it will be very helpful
hi bro, if we create strings in non-constant loop like String s1=new String("java"); then how string is immutable,please kindly explain it
When we create String using new operator 2 things happened 1st object created on heap and also same string also create on pool. Hope this help.
Awesome Video , Can you please make one video on this program -> "You are given an array of 0s and 1s in random order. Segregate 0s on left side and 1s on right side of the array. Traverse array only once". I encountered this question in of the interviews I gave.
Thanks in Advance
public class segregate {
public static void main(String[] args) {
// TODO Auto-generSated method stub
int arr[] = {1,0,0,1,0,1,0,0,1,0,1};
System.out.println(arr.length);
int j = -1;
for (int i = 0; i < arr.length; i++) {
// if number is smaller than 1
// then swap it with j-th number
if (arr[i] < 1) {
j++;
int temp = arr[j];
arr[j] = arr[i];
arr[i] = temp;
}
}
System.out.println("");
for(int m=0;m
By using this method we can segregate as per ur question
Arrays.sort(a[]);
arr = [1,0,0,0,1,1]
d = {}
for i in arr:
d[i] = d.get(i,[]) + [i]
new_arr = []
if 0 in d:
for i in range(len(d[0])):
new_arr +=[0]
if 1 in d:
for i in range(len(d[1])):
new_arr+=[1]
print(new_arr)
Since immutable string is sharing memory, how this can provide high security?
Because there is no easy way to write to that shared memory, unlike the Wild, Wild West of the C++ heap where pointers roam wild and free like tigers.
great explanation as always.
Thanks Gunay
nicely explanation , thanks naveen
awsome naveen bro.nice way of telling....👌
my question is regarding Xpath ... as u said in drop down session like By.id() in main()... but wen v separately save xpaths in .propertiesfile and wen v want to automate that through keywords.java class den how to use it ...
public void choose(String objectname, String data)
{
Select select = new Select(driver.findElement(By.xpath(prop.getProperty(objectname))));
select.selectByVisibleText("working"); // ???
}
leadstatus= //*[@id='23:3372;a']/div/a dis is how i saved in objectrepository.propertiesfile
???
Thank you so much! Very detailed explanation.
sorry to be so offtopic but does anybody know of a way to get back into an Instagram account?
I was dumb forgot the login password. I would appreciate any tricks you can offer me.
@Winston Corey Instablaster :)
@Randall William thanks for your reply. I got to the site through google and im trying it out now.
I see it takes a while so I will reply here later with my results.
@Randall William It worked and I actually got access to my account again. I am so happy!
Thanks so much, you really help me out :D
@Winston Corey glad I could help :)
Hi naveen, please nake videos on protractor ...
Hi Naveen, thanks for your helpful videos.
If for an example
String s="abc";
s=s.concat("def");
System.out.println(s);
O/p: abc def
So string value got changed.
Could you please explain string is immutable concept using the above example
After concatenate new object("abcdef") is created. Now s will refer to new object rather than old object("abc"). Old object is not changed and is no more referred by reference(s).
@@uk7826 thank you
S1 will not change if S2 value is changed
package com.basics.packageone;
public class pkg_1_n12_stringTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
String v1 = "Hai";
System.out.println("V1 is " + v1);
String v2 = "Hai";
System.out.println("v2 is " + v2);
v2 = "Bye";
System.out.println("V2 after change is " + v2);
System.out.println("V1 after change is " + v1);
}
}