R K Singh

Ranch Hand
+ Follow
since Oct 15, 2001
R likes ...
Spring Java
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by R K Singh

I understand that it's not the right forum, but I could not think otherwise.

I failed to find the Section for forums for Cloud, let it be AWS/Azure/Google, etc.

Just a meaningless thought.

1 year ago

Monica Shiralkar wrote:

Campbell Ritchie wrote:What do you think, MS?

I have seen that at times and have wondered why were these kept in a single file instead of multiple. To me having 1 file per class looks more readable.

unless you dont want that class to be accessible by others
3 years ago

It is programmed to look for the first class in the file, I think, regardless of its access. If you use the old way of compiling code, with javac and java, there is no requirement for the class with the main() method to be public, either.

My bad, never tried, and trusted the theory that class has to be public so that jvm may call its public main() method. (Or may be I assumed that class has to be public )

I think it may work if there is only one class in the package

Anyway, thanks for the clarification.
3 years ago

Tanuj Bhatt wrote:
Also i now able to run the connection after changing all the path to jdk 1.8 but still i want to know how to run the mysql connection in jdk 11 and higher as per i know they don't have a separate jre folder to put connector jar file

May be JDK11 and higher needs different MySQL driver file.

But its sad if Oracle is not maintaining backward compatibility.

Campbell Ritchie wrote:DJ: Welcome to the Ranch

I don't know whether things are different on JDK13 but I had no difficulty getting this file to run:-

critchie@localhost directoryXXX]$ java SingleFileDemo.java Campbell Jeanne Liutauras Bear
SingleFile object with field = Campbell
SingleFile object with field = Jeanne
SingleFile object with field = Liutauras
SingleFile object with field = Bear

how can JVM run without class being public ??

or am I missing something ??
3 years ago

Mohana Mahalingam wrote:

1)When I execute the above program, answer is
Value2found at2,0
Can you explain how the value 2,0 is obtained when Break Parent_Loop is replaced with Break statement?

2) When I execute the same with Continue parent_Loop the same answer is obtained.
Can we consider break and labelled Continue statements as the same?

3) When the program is executed with Continue statement, the answer is Value found at 2,1.

Please provide explanations how these statements are working
Thanks in advance

hmmm... These are basics as everyone advised, you should try it to get yourself using pencil paper or learning about them, in your case, you should learn more about break and continue.

You seem to be not able to understand break and continue.

I will try to provide pointers here, you have to explore more by yourself.

break :
break is used to come out of the immediate loop on meeting some condition.
break with label will come out of the labelled loop on meeting some condition.

continue :
continue is used to skip the rest of the execution on meeting some condition, and makes the program to execute the next iteration in your loop.

All the best

Paul Anilprem wrote:If you just return -1 , 0, and 1, you won't be able to order the objects efficiently.

I really doubt that returned value decide the order of object.

Its just lazy n quick practice of returning a -b for comparison.

Or am I missing something ??

Henry Wong wrote:
you are passing List<Poodle> and List<Dog> instances... and there isn't a IS-A relationship between List<Poodle> and List<Dog>.

If that is the case then why does dogsBark2(poodles, poodles); work ?

List<Poodel>, List<Poodle> is not List<Dog>, List<Dog>

or am I missing something ??

Any explanation will be really helpful.

What is the type of ncr ?

It is not declared in the lines you posted here.
I think you want to use incr reference variable at line 19.
7 years ago
oh man .. I dont want to be old but now remembering old good days means I am getting old ..

Anyways .. happy Valentine week to all :-)
7 years ago

Campbell Ritchie wrote:Naaaaa!

I have only been here about 11½ years.


you are old man bro ;-)
7 years ago
Came to the site after a long time ..

I find lot of new features and personalization added to the site.
Kudos to all who work voluntarily to maintain the website.

I am not sure how many old timers are still roaming around here.

Old members say Yaaa !!
7 years ago
All enhancements to java, I am sure will turn out to be useful.

But being a old student, I still feel that by allowing public/private methods to interface we are somehow taking interface to a point where the only difference with class will be that interface will not have state (member variables). And who knows Java 11 may have that too ;-)

Anyways, java was proud to have solution for diamond shape, but now we have resolution operator in java also.

Thanks a lot for your inputs.
8 years ago

I tried to find answer outside wide world, but I failed, so I am asking this question here:

What is the difference between Abstract Class and interface in java 8, if it allows interface to have implementation of method also ?

Thanks for helping in understanding the new concept.
8 years ago