Results 1 to 2 of 2
  1. #1
    zen_to_go is offline Member
    Join Date
    Oct 2007
    Posts
    1
    Rep Power
    0

    Default Passing variable information between classes

    This code works, I just want to know if the structure is good or bad?
    I want to know your opinions on the best way to pass variable results
    between classes.

    If I write a class that calculates tax etc and I want to pass that result to another class to be used in an array or another calculation should I do it like this?




    Java Code:
    public class totalMe {
    
    	private static String word;
    
    	/**
    	 * @param args
    	 * @param word 
    	 */
    	public static void main(String[] args) {
    		
    	smallSum sm = new smallSum();
    	
    	
    		
    	System.out.print(sm.TheWord(word));	
    		
    		
    
    	}
    
    }
    
    
    class smallSum{
    	
    	public String TheWord(String word){
    		
    	word ="did it work?";	
    	
    	return word;
    		
    		
    	}
    	
    	
    	
    	
    
    }


    Thanks for your time ---

    ZTG

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    10

    Default

    Yes, "information passing between the classes" looks good to me. But you should better to practice on Sun's code conventions.

Similar Threads

  1. Passing Environment Variable in Eclipse Europa
    By ajaymenon.k in forum Eclipse
    Replies: 0
    Last Post: 11-19-2007, 10:08 AM
  2. system information
    By nitinborge5 in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 09:25 AM
  3. Variable passing, Error: IOException
    By fernando in forum New To Java
    Replies: 3
    Last Post: 07-31-2007, 02:03 PM
  4. Information about Struts
    By Felissa in forum Web Frameworks
    Replies: 2
    Last Post: 07-02-2007, 04:40 PM
  5. Some information about Hibernate
    By Marcus in forum JDBC
    Replies: 2
    Last Post: 07-02-2007, 04:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •