• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

what is the difference - basic

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

[ November 10, 2003: Message edited by: Marilyn de Queiroz ]
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Want a better answer? Ask a better question.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mr Boy,
I'm sure I've explained the Java Ranch naming policy to you before. Please go here and change your display name to comply with it immediately, or I'll be forced to close your account. And I don't want to do that.
 
KunkalaGuntala Samba Siva Rao
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ernest Friedman-Hill:
Mr Boy,
I'm sure I've explained the Java Ranch naming policy to you before. Please go here and change your display name to comply with it immediately, or I'll be forced to close your account. And I don't want to do that.

 
KunkalaGuntala Samba Siva Rao
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by ooty boy:

sorry i am new to java, is anything not clear.

 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ooty boy,

I don't understand your question. These two classes don't look the same at all. Can you be more specific about your question?

By the way, your display name is unacceptable on JavaRanch. Please change it.
 
KunkalaGuntala Samba Siva Rao
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
currently my classes look as if its shown in option1.
if i split this like option2, will it make any difference in terms of memory allocation
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by KunkalaGuntala Samba Siva Rao:
will it make any difference in terms of memory allocation


I don't think rearranging the classes would effect memory allocation much. It appears that you are just moving around the responsability for creating the screens. Looking into my crystal ball it appears you are trying to write a kind of search wizard with 4 screens and some navigation buttons. Clicking on a navigation button takes you to a new screen. You appear to create a new instance of each screen every time you navigate. This is a Bad Idea since object creation takes processor time, memory, and more processor time to reclaim once the object goes away. Look into java.awt.CardLayout. It lets you put a number of screens into a component and display them by name. It will take up more memory than your solution, but it is more efficient because the computer can concentrate on processing data rather than racing to create a new screen AND process data.
 
KunkalaGuntala Samba Siva Rao
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for some reasons i couldn't use the CORD Layout
Will it take more memory and process speed if i pass the object like shown below
class DATAClass{
private String dbName;
private String dbconn;
private Resultset rs;
public DATAClass(String databaseName, Connection conn) {
dbconn = conn;
dbName = databaseName);
}

public ResultSet GetMethod1(Connection conn, String id) throws SQLException {
CallableStatement sproc_stmt = conn.prepareCall("{call " + dbName + ".." + "PROC1" + " (?)}");
ResultSet sproc_result = DatabaseProxy.toResultSet(sproc_stmt);
return sproc_result;
}

public ResultSet GetMethod2(Connection conn, String id) throws SQLException {
}

..more methods here for each stored proc
}

class MAINClass {
public MAINClass(){
jbInit();
}
jbInit() {

DATAClass d1 = new DATAClass("dbname","conndetails");
//Invoke the first class and load components
Class1 c1 = new Class1(d1);
c1.load_components1();
}
}
import com.samples.DATAClass;
Class1 {
private DATAClass data1;
public Class1(DATAClass d1){
data1 = d1;
}
load_components1() {
EXECUTE data1.GetMethod1;
//Paint components
}
button_click() {
Class2 c2 = new Class2(data1, this);
}
}
import com.samples.DATAClass;
Class2 {
private DATAClass data2;
private Class1 c1;
public Class2(DATAClass data, Class1 class1 ){
data2 = data;
c1 = class1;
}
load_components2() {
data2.GetMethod2();
}
go_back() {
c1.load_components1();
}
}
reply
    Bookmark Topic Watch Topic
  • New Topic