• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling methods in a different file?  RSS feed

 
John Sing
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sorry I have been asking so many questions lately but I am really confused about something. I am trying to make a driver class for my code to call methods into another file. Here is the code I am trying to call the method from



and here is the code for the driver call I am trying to create



when I try to compile that I get the following error

" [line: 6]
Error: non-static method removeWhiteSpaceAndConvertToUpper() cannot be referenced from a static context"

so what can I do to fix this? I tried a few things but they all failed and I am really confused. Thanks in advanced
 
Campbell Ritchie
Marshal
Posts: 55789
164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put all that code aside and try something simple for a change. There is no point in tying yourself in knots about the encryption thing until you can write classes.

Write a Kettle class with heat() cool() and toString() methods. If you cannot do that, search my posts. Write a KettleDemo class with a method run() or similar, and you can see the sort of thing which should go into the run method here. The main method can go in KettleDemo or another class and is shoud be short. Very short. This is an example of what should go in it:-And that is it. Nothing else in the main method. Every other line of code goes elsewhere.
 
Campbell Ritchie
Marshal
Posts: 55789
164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
… and the word static must not be used anywhere else.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!