Reputation:
I am learning Java and I have came across few packages like util
package, swing
package etc. I want to dig it more so my question is when we import any packages in our source code where can I see those packages and the class codes in my personal computer.
Let's say there is an util
package and ArrayList
class. So where can I find the util
package and ArrayList
class?
Can I make any changes to ArrayList
class or any other class?
I am trying to have the packages and class code without Eclipse installation. I have installed JDK and JRE and running the Java files through command prompt and using Notepad++ for writing code.
Upvotes: 1
Views: 711
Reputation: 1271
where can I see those packages and the class codes in my personal computer.
Just click control key and right click of mouse at ArrayList
Object if u use eclipse
or netbeans
if not then you find it here
C:\Program Files\Java\jdk1.6.0_11\jre\lib\rt.jar
Can I make any changes to ArrayList class or any other class?
You can't simply.java.util
package contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes and is provided by JRE
Upvotes: 1
Reputation: 201537
java.util.ArrayList
is provided by the JRE, it is in rt.jar
(and you can see the source).
Can I make any changes to ArrayList class or any other class?
You could sub-class ArrayList
(or simply implement List
), but you can't really alter built-in classes (and even if you could, your code would then not be portable).
Upvotes: 4