hi there
i wanted to know if there is something like global or extern variables
(in,c language),which i can use in every class ?!
and my other question is ,if is there a complete tutorial on netbeans
gui builder , because i have lots of problems about jframes.
thanks a lot.
xlx 0 Newbie Poster
Recommended Answers
Jump to PostThere are no such thing as either golobal nor global vars. There are "constants" i.e. public static final variables, but they still need to be referenced through the class. That can be done in the imports however using a static import. I.E.
// class Test1 package test; …
Jump to PostI didn't know that this was possible. Good.
Yep. Works with all static items, not just final static items, and not just variables.
//Class Test1 package t1; public class Test1 { public static void printIt(String s) { System.out.println(s); } } //Class Test2 package t2; import static t1.Test1.printIt; …
Jump to PostIf they are static there is no reason to create a "bank_account" object, simply reference the class (i.e. bank_account.search(whatever)). If your application is going to be threaded, however, you are going to have to synchronize those methods. A better solution in this case is probably a Singleton. Google for "Java …
All 9 Replies
masijade 1,351 Industrious Poster Team Colleague Featured Poster
javaAddict commented: Thanks for the new info +5
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster
xlx2 0 Newbie Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster
xlx2 0 Newbie Poster
xlx2 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.