Results 1 to 3 of 3
- 02-23-2013, 03:11 PM #1
Member
- Join Date
- Aug 2010
- Posts
- 70
- Rep Power
- 0
<RESOLVED>Passing a Statement Object into a Program Object
The main issue is that I am having a reference to a non-static type, but Statement must be static.
Can I ensure that the syntax is at least right? This comes from a parser program. Error marked below in the code
StatementList class is shown below:Java Code:public <Program> Program Parser (String fileName) throws FileNotFoundException, LexException { if (fileName == null) throw new IllegalArgumentException ("null string argument"); lex = new LexicalAnalyzer2(fileName); L = StatementList.getStatement(); // ***this is the error **** Program prog = (L); return prog; }
Thoughts?Java Code:public class StatementList { /** * This method takes the Statement List and returns the getStatement method. */ public StatementList () { getStatement(); } // This method will use the Statement class with this project and privatize it and return it. // The Statement class will then use the line number, basic statement, and EOLN token. public static void getStatement() { //this.Statement = Statement; while (Parser.lex.moreTokens()) { Parser.lex.getNextToken(); } System.out.println("no more tokens"); } }Last edited by Adomini; 02-23-2013 at 03:58 PM.
- 02-23-2013, 03:42 PM #2
Godlike
- Join Date
- Nov 2012
- Posts
- 194
- Rep Power
- 1
Re: Passing a Statement Object into a Program Object
L = StatementList.getStatement() assumes the method returns something but the method is void: public static void getStatement(). This does not return anything.
- 02-23-2013, 03:57 PM #3
Member
- Join Date
- Aug 2010
- Posts
- 70
- Rep Power
- 0
Similar Threads
-
Object-Parameter passing costs
By NewEonOrchestra in forum New To JavaReplies: 1Last Post: 05-16-2012, 05:23 PM -
java-object passing by value
By aumkar0406 in forum New To JavaReplies: 15Last Post: 01-04-2012, 02:08 AM -
passing an object from one JDialog to Jframe
By sinha in forum AWT / SwingReplies: 7Last Post: 12-16-2009, 04:56 PM -
Passing SWT object to another class
By Vinaya Lal Shrestha in forum SWT / JFaceReplies: 0Last Post: 04-03-2009, 01:50 PM -
passing object as value for checkbox values??
By Pooja Deshpande in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 03-17-2009, 11:55 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks