|
Depends on the purpose for the class. I might add that I too am a rookie to Java. (I hate the term newbie). If it is a class that accesses a table, there are normally setter and getter routines for accessing the data. I'm sure some of the more seasoned Java pros here will chime in for other reasons and theories. Thanks, Mark Mark D. Walter Senior Programmer/Analyst CCX, Inc. mwalter@xxxxxxxxxx http://www.ccxinc.com Shane_Cessna@nal. com Sent by: To java400-l-bounces Java Programming on and around the @midrange.com iSeries / AS400 <java400-l@xxxxxxxxxxxx> cc 06/13/2005 10:02 AM Subject Re: "new to Java" question... Please respond to Java Programming on and around the iSeries / AS400 <java400-l@midran ge.com> Mark, Thanks for the response...I just was curious if it could be done...is it common, then, to have a crapload of class variables?... Shane Cessna iSeries Programmer iSeries WAS Administrator North American Lighting, Inc. (618) 662-4483 x2776 shane_cessna@xxxxxxx MWalter@xxxxxxxxxxxxxxx Sent by: java400-l-bounces@xxxxxxxxxxxx 06/13/2005 08:57 AM Please respond to Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> To Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> cc Subject Re: "new to Java" question... Isn't that the idea behind encapsulation? So method variables cannot be accessed. Make them class variables. Thanks, Mark Mark D. Walter Senior Programmer/Analyst CCX, Inc. mwalter@xxxxxxxxxx http://www.ccxinc.com Shane_Cessna@nal. com Sent by: To java400-l-bounces JAVA400-L@xxxxxxxxxxxx @midrange.com cc Subject 06/13/2005 09:52 "new to Java" question... AM Please respond to Java Programming on and around the iSeries / AS400 <java400-l@midran ge.com> Is there an easier way to access method variables in another method other than passing them on the call? here's an example: public static void main(String args[]) { DB2400 nal820 = new DB2400("nal820"); getData(nal820); nal820.disconnect(); } public static void getData(DB2400 nal820) { //process data } could I do something in the getData method to access my "nal820" variable without passing it? I'm sure it's something really easy and basic, but like the subject says, it's a "new to Java" type of question...Thanks... Shane Cessna iSeries Programmer iSeries WAS Administrator North American Lighting, Inc. (618) 662-4483 x2776 shane_cessna@xxxxxxx -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l. -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l. -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.