Win a copy of Python Continuous Integration and Delivery this week in the Python forum!

B Verma

Greenhorn
+ Follow
since Jun 07, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
4
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by B Verma

Matthew Brown wrote:I'd expect it to be the same as default, except the class would be visible to subclasses. But how do you subclass something that isn't visible already?



Its a perfect answer to "Why can't we have the 'protected' modifier for a top-level class". Assume it's allowed to use protected modifier for a class. Then what will happen, it will be visible to all the classes in the same package which is the same behavior what a default (package-level) access class will possess. Additionally this 'protected' class should be visible to all the subclasses outside package also. But unfortunately you would not be able to create any subclass of this class outside the package because this class itself will not be visible outside the package. Hence without the subclass specific behavior, this 'protected' class will be exactly same as a package-level or default access class. So, there is absolutely no need of 'protected' modifier for classes and hence, not permissible as well.

Hope, it helps although I just tried to elaborate Matthew's point.
6 years ago
Hi Saloni,

Since you know the theory of Java and you just need to explore things practically. So, why don't you go for java certification, preparing for which will help you understand the topics practically. My suggestion would be to read SCJP 6 guide by Sierra and Bates and upon finishing it, go for a SCJP6 (now OCJP 6) certification exam as well. It will make you comfortable in all topics of core Java
6 years ago
I do agree with you Junilu.
6 years ago
Try .getClass() method, which returns the runtime class of an object.

<someObject>.getClass();
6 years ago

Campbell Ritchie wrote:Welcome to the Ranch

I wasn’t aware of that class; there are all sorts of useful things hiding away in the Apache project.



Thanks Campbell, yes indeed these Apache classes are having lot of useful utilities worth exploring.
6 years ago
You can use org.apache.axis2.databinding.utils.ConverterUtil.toList(Object[]) to convert any array to a list. The generated list will be independent of the array, means you can add, delete or modify any element in the list without affecting the array.

Example:-

String[] strArray = {"data1","data2","data3","data4","data5"};
List list = ConverterUtil.toList(strArray);


Hope this helps
6 years ago