Questions tagged [main-method]

115 questions
-2
votes
1 answer

Main method DriverMortgageClass.java

I am close to completing this program but it cannot run because it needs a main method. However whenever I enter it I recieve the error code illegal start of expression. Can someone point out where the main method belongs in this code snippet?…
David
  • 11
  • 2
-2
votes
1 answer

Why is a program main method static?

I always thought (assumed) that the Main method was static because you cannot have multiple instances of it (Correct me if that's wrong). The Main method is the start point of your program and thus you can have only one. So if I have class…
Ixcioran35
  • 21
  • 6
-2
votes
1 answer

Assistance with this java method! please! darn Tables

please excuse my noob, but my current level of java knowledge is quite base. I really need help with an exercise, but it is a little beyond my very basic level of Java, (i.e. I'm only confident in declaring variables lol) But here is the question…
-2
votes
1 answer

I compiled my entire program and there is no errors, but nothing shows when I run it

I think this is weird because when I ran it before on Eclipse, this program worked. However, when I try to run it using 'java PacMan', then nothing shows up. I think it is because I am missing a main method, but I'm not sure how to integrate that…
wannabeprogrammer
  • 125
  • 1
  • 3
  • 9
-3
votes
4 answers

Where do I add a main method so that I can run this program properly?

I don't know where to add the main method so I can run this class. Help! I'm not sure about where to put the main method either. This class manages a hair salon. Global variables are used to keep track of dailyRevues (total $ coming in), dailyTax…
Noaki
  • 7
  • 3
-3
votes
1 answer

I keep getting the error, "The system couldn't find a suitable main method." - Java

I am working on a project for my Operating Systems class, and we are required to create a program that reads a text file of 3-digit integers, interpret each digit of the integer to complete the specified task, and then print out the value of each…
Morgan4568771
  • 143
  • 1
  • 5
  • 11
-3
votes
1 answer

Java Programming: Compiler error, class interface, or enum expected in main(String[] args)

I'm in the process of creating a backgammon game. To start with I am just trying to put in a main method so that I can put in some psuedo code ready to be turned into real thing. However whenever I try and compile my present code I get a compiler…
user1845855
  • 11
  • 1
  • 1
-4
votes
2 answers

how to fix Main method?

how to fix this problem: Main method not found in class jamel.Jamel, please define the main method as: public static void main(String[] args) enter image description here
samira
  • 1
  • 1
-4
votes
2 answers

How to insert doubles into the main method?

I am trying to write a program that calculates my math and English GPA. I can't get the main to recognize my two floats, mathGpa and englishGpa. It tells me to make them static but making them static means that they become strings and I need them to…
Barn Cats
  • 5
  • 1
-5
votes
1 answer

How to call a method from main, even though I haven't defined variables in main.

I haven't initialized anything on main. All I want is to call an outside method. However, when calling on picnicCost(), I don't know what to put inside the parenthesis since I didn't use any variables in main. import java.util.*; public class…
Rudy V
  • 11
  • 5
1 2 3 4 5 6 7
8