Linked Questions

116 votes
8 answers
496k views

Building a multi-language application in Java. Getting an error when inserting String value from R.string resource XML file: public static final String TTT = (String) getText(R.string.TTT); This is ...
Chen M's user avatar
  • 1,297
27 votes
6 answers
314k views

I have class foo{ public static void main(String[] args){ do(); } public void do(){} } but then when I call do() from main by running the command java foo on the command line, java ...
kamikaze_pilot's user avatar
0 votes
3 answers
12k views

I'm newer to programming and keep getting the non-static method cannot be referenced from a static context when calling my floor class from my ant class. I've removed all statics and am still getting ...
Tessa Olowniuk's user avatar
1 vote
4 answers
10k views

So I just started programming and what not and this question has me tearing my hair off. It's asking "Under what circumstances, if any, can a static method call an instance method?" I've tried going ...
Laura Rosario's user avatar
0 votes
2 answers
2k views

I have question about static methods in Java. Why is that I can call a non-static method in another non-static method without specifying an instance of the class. For example if I have two non-static ...
Kev Man's user avatar
  • 47
0 votes
1 answer
2k views

I am new coder taking a class over computer science. We are working with Java. The assignment was given through a pdf that I reuploaded as a photo here https://i.sstatic.net/xNEdm.png. Here is my code ...
OSG's user avatar
  • 113
-1 votes
1 answer
2k views

I am using swing to make a java project with JFrames. I am trying to call the non-static method build(), which builds the JFrame with its components. However, build can't be static because I am using ...
Santiago Benoit's user avatar
0 votes
5 answers
316 views

UPDATE: I made some changes based on some answers I got and it worked. The correct code is- public class Tsett { static HashSet<String> names=new HashSet<String>(); static ...
yash10p's user avatar
  • 33
0 votes
2 answers
934 views

Possible Duplicate: calling non-static method in static method in Java I am running into the "non-static method cannot be referenced from a static context"-error when i try to call a method that ...
user2005142's user avatar
-4 votes
1 answer
862 views

I have got through most of my code for a Student Registration Interface without difficultly, however I am getting this error. non-static method cannot be referenced from a static context. Now, I ...
SIHB007's user avatar
  • 69
0 votes
1 answer
974 views

I'm getting an error when I try to get a non-static string in a static class. this is the warning message "non static field cannot be referenced from a static context" I want to get DOWNLOAD_URL ...
Arsyah's user avatar
  • 1
-2 votes
1 answer
744 views

I have read this question, but my issue is different because mine isn't about this error message specifically; I was just using it to realize I had made a different kind of mistake. Please read my ...
Molly Taylor's user avatar
0 votes
3 answers
592 views

when i try to compile this it gives me an error for a non-static method begin(int) cannot be referenced from a static context. Any way this can be fixed? import java.util.Scanner; import objectdraw.*;...
Nong Shim's user avatar
4 votes
2 answers
169 views

I can create an object in the main method and call the other method with the object I created. public class Obj{ public static void main(String[] args) { Obj obj = new Obj(); obj....
OPK's user avatar
  • 4,180
-3 votes
3 answers
405 views

So I know there are probably 100 threads about this topic already. Yes I tried to read them but i can't for my life understand the concept of context in Android :( I want to call a non-static method ...
Daniel Andersson's user avatar

15 30 50 per page
1
2 3 4 5