Home arrow static arrow Java Programming [Archive] - how to integrate two codes ?
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - how to integrate two codes ?
This topic has 8 replies on 1 page.

Posts:1,367
Registered: 1/5/04
how to integrate two codes ?  
Jun 15, 2004 6:17 AM



 
A.java


class A
{
public static void main(String args[])
{

System.out.println("hello");

// code

}

}

Format.java


import java.util.*;

class Format

{

public static void main(String args[])
{
System.out.println("hi");
// code

}

}

how to integrate two codes ?

 

Posts:24,036
Registered: 2/3/03
Re: how to integrate two codes ?  
Jun 15, 2004 6:28 AM (reply 1 of 8)



 
Please be a little more explicit about what you're doing, what you expect to happen, and what you actually observe - "integrate two codes" isn't very clear.

Please post a short, concise, executable example of what you're trying to do. This does not have to be the actual code you are using. Write a small example that demonstrates your intent, and only that. Wrap the code in a class and give it a main method that runs it - if we can just copy and paste the code into a text file, compile it and run it without any changes, then we can be sure that we haven't made incorrect assumptions about how you are using it.

Post your code between [code] and [/code] tags as described in [url=http://forum.java.sun.com/features.jsp#Formatting]Formatting Help[/url] on the message entry page. Cut and paste the code, rather than re-typing it (re-typing often introduces subtle errors that make your problem difficult to troubleshoot). Please preview your post when posting code.

If you don't know where to start, here are some excellent resources:
http://java.sun.com/docs/books/tutorial/
http://java.sun.com/developer/onlineTraining/Programming/BasicJava1/compile.html
http://java.sun.com/learning/new2java/index.html
http://javaalmanac.com
http://www.jguru.com
http://www.javaranch.com
Bruce Eckel's [url=http://mindview.net/Books/DownloadSites]Thinking in Java[/url]
Joshua Bloch's [url=http://www.amazon.co.uk/exec/obidos/Author=Bloch,%20Josh]Effective Java[/url]
Bert Bates and Kathy Sierra's [url=http://www.amazon.com/exec/obidos/tg/detail/-/0596004656?v=glance]Head First Java[/url]
 

Posts:11,200
Registered: 7/22/99
Re: how to integrate two codes ?  
Jun 15, 2004 6:28 AM (reply 2 of 8)



 
What do you mean by "integrate"? I know a couple of meanings that word could have and none of them can be applied to "codes" ...
 

Posts:1,888
Registered: 22/08/01
Re: how to integrate two codes ?  
Jun 15, 2004 6:28 AM (reply 3 of 8)



 
define "integrate"
 

Posts:8,813
Registered: 10/4/00
Re: how to integrate two codes ?  
Jun 15, 2004 6:36 AM (reply 4 of 8)



 
Format.main(new String[] = {});

P.S. Tada!!! ... Did I mention... Tada!!!
 

Posts:957
Registered: 3/31/04
Re: how to integrate two codes ?  
Jun 15, 2004 6:42 AM (reply 5 of 8)



 
cut n paste

:-P
 

Posts:3,258
Registered: 00-08-28
Re: how to integrate two codes ?  
Jun 15, 2004 7:37 AM (reply 6 of 8)



 
A.java


class A
{
public static void main(String args[])
{

System.out.println("hello");

// code

}

}

Format.java


import java.util.*;

class Format

{

public static void main(String args[])
{
System.out.println("hi");
// code

}

}

how to integrate two codes ?

By integrate if you mean merge you could use a configuration manager tool, but merge is normally done on different versions of the same code. However it seems that you have two different classes. By integrate if you mean refactoring them into one then your IDE like eclipse might be helpful in here. Or to make it still simpler copy and paste may be good. But the question is still there what you mean by the integration.

 

Posts:1,367
Registered: 1/5/04
Re: how to integrate two codes ?  
Jun 15, 2004 8:29 PM (reply 7 of 8)



 
hi....i wrote two big code...... both of them r working individually...... both of them have main method in them......but i want to make a single code with only a single main method . which way i should proceed ? should i create an object of the class of the second code ? and call it via first code or what i should do ?
i made those code working by taking help form u people.
now i want to merge two code. any suggestion ? but which way i should go ?
 

Posts:31,095
Registered: 4/30/99
Re: how to integrate two codes ?  
Jun 15, 2004 8:44 PM (reply 8 of 8)



 
That depends on what you want the resulting program to do. There isn't a standard answer to your question because it is not a common thing to want.
 
This topic has 8 replies on 1 page.