Questions tagged [main-method]
115 questions
0
votes
2 answers
How to associate an instance variable if all the code is inside a run() method?
I'm supposed to be creating a game, and we've been given free rein in creating it...but I have no idea what I'm doing. I copied the format of a previous lab, because I needed a way to run it, but now I have a problem. My Gui class is as…
![](../../users/profiles/5495774.webp)
MaddoxJKingsley
- 17
- 3
0
votes
1 answer
Error: Main Method exceeding bytes limit
I'm having an issue where I'm getting the error code:
Error: The code of method main(java.lang.String[]) is exceeding the 65535 bytes limit
while programming java.
I'm really quite new to java, and I don't really know what to do now.
I have…
![](../../users/profiles/5458226.webp)
Katrineeee
- 1
- 1
0
votes
3 answers
How can I refer to a variable under a static method in the main method?
My codes are like the following.
public class readfile {
public static void readfile() {
int i = 0;
System.out.println("hello");
}
public static void main(String[] args) {
readfile();
…
![](../../users/profiles/5379724.webp)
654170523
- 11
0
votes
1 answer
Writing a main method for this search function
I need some pointers as to how to write the main method for this mini-search engine I'm writing. Here is my code:
public class StringSearch {
private String s1 = "ACTGACGCAG";
private String s2 = "TCACAACGGG";
private String s3 =…
![](../../users/profiles/4687940.webp)
Tim Tolbert
- 7
- 3
0
votes
0 answers
Error:Main() method not found/ Running a spark code
I'm using spark-1.4.1, scala 2.10.5 and I code on eclipse IDE. I encounter the following error:
Error: Main() method not found
Cannot export the JAR file as it does not recognize the main class
How to start with writing a spark code?
import…
![](../../users/profiles/5057446.webp)
spark_dream
- 316
- 2
- 6
- 22
0
votes
4 answers
Main method is not static in class error
class useTent
{
Scanner keyboard=new Scanner (System.in);
public void main (String[] args)
{
Tent t= new Tent();
HireContract hc = new HireContract();
ProcessHire(t, hc);
}
}
this is my code, and i keep…
![](../../users/profiles/4723176.webp)
Emma Sproule
- 11
- 1
- 5
0
votes
1 answer
Getting Error : Exception in thread "main" while executing program for different loop conditions in static block
There is no problem in program execution if i am having loop condition as little value (i.e. 1000 or 10000) in static block, its working. the problem is in loop in static block for given code. whenever i am executing below code i am getting…
![](../../users/profiles/2987706.webp)
Prashant
- 2,480
- 2
- 17
- 26
0
votes
2 answers
Iterate through main function in C?
Here is my main function:
int main(int argc, char **argv)
{
LoadFile();
Node *temp;
char *key;
switch (GetUserInput())
{
case 1:
temp = malloc(sizeof(Node));
printf("\nEnter the key of the new node: ");
scanf("%s", temp->key);
…
![](../../users/profiles/200477.webp)
Mohit Deshpande
- 48,747
- 74
- 187
- 247
0
votes
1 answer
functions calling from main method objective c
Here I need to write a function which is called from main method with integer array as a parameter please give me example.
In below example parameter are int type.
Note : please tell this is correct way to do this or not...
#import…
![](../../users/profiles/4029548.webp)
Nirbhav Gupta
- 96
- 2
- 8
0
votes
1 answer
How do you write a main method to start a java program?
I'm a beginner programmer and am tasked to write an inventory program.
I have only programmed using BlueJay so far, but am about to learn how to use the vim editor.
When programming with BlueJay, you didn't need to write a main method.
I'm so lost…
![](../../users/profiles/1759727.webp)
DaveMcFave
- 223
- 1
- 3
- 12
0
votes
1 answer
Joining Multiple Projects in one solution
I have started creating a game, and I added a second project, it's the standard XNA Windows game 3.1 project, and since the other project already had a Main to start the program and the 2nd is for game data, where as the first was for the drawing…
![](../../users/profiles/301949.webp)
PCAddict
- 35
- 5
0
votes
1 answer
Netbeans Error: Could not find or load main class
When I run the below code, I get the error that Could not find or load main class. I have removed the package and created it again. But the error is still exist. I did some methods to fix it such as right clicking on package name -> properties ->…
![](../../users/profiles/3354617.webp)
User
- 67
- 1
- 1
- 4
0
votes
4 answers
Using XML-derived Variables in the Main Method
so I am making a game where the player's skill damage is determined by their Skill Level and their weapon Mastery. The two values are stored in an XML document, and I am using DOM to retrieve the values, and am trying to print their sum to the…
![](../../users/profiles/3427093.webp)
Jack
- 250
- 1
- 3
- 12
0
votes
3 answers
Name that pattern: Does a decent name for this type of executable module already exist?
I'm having trouble naming a set of software modules that follow the same pattern. I'm hoping this already is a named pattern as I can't come up with a decent name.
The situation:
I have a fairly sophisticated/complex object oriented application,…
0
votes
5 answers
Accessing variable in Main method from other class
I have two classes:
public class node {
static LinkedList nodes = new LinkedList();
public boolean visited;
public static void Main (String args []) {
System.out.println("Number of nodes in network");
Scanner sc =…
![](../../users/profiles/3003211.webp)
Gaurav K.
- 57
- 2
- 3
- 10