Questions tagged [main-method]
117 questions
0
votes
1 answer
Error appears when i try to call a method of class B in class A without main method
class B {
void view(){
System.out.println("in class b");
}
}
public class A {
B obj = new B();
obj.view();
}
in this code on the line obj.view there appears an error: syntax error on token view, identifier…

piePatch
- 3
- 2
0
votes
1 answer
java program have only one public class should main method only be part of that public class then any other class of that program?
program running fine when main method is inside class QNA but give error when defined inside class test
error: Main method not found in class QNA, please define the main method as:
public static void main(String[] args)
or a JavaFX application class…

Pooja Choudhary
- 19
- 2
0
votes
3 answers
The main method isn't found in my GUI class
I've assembled a basic GUI but the debugger says there is no main method even though there is a static void main(String[] args) here is my code
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import…

Hunter Lindsey
- 59
- 6
0
votes
1 answer
How to load Results from a different method into a variable using C#
My Main Method is calling another method(SqlConnector) which is fetching results from SQL database. I need load the results from SqlConnector Method into a variable called "ID".
Nothing happens when i execute this. I don't think my SqlConnector…

Vinny
- 461
- 1
- 5
- 18
0
votes
0 answers
calling method from different class raising "Main method not found in class com.company.UniLink" error
I am working on this console base application.it is basically a university system on which a student can post different kind of posts and people can reply to there posts.
so, i have this startup class
public class startup {
//not keeping all…

Ayush Ranjan
- 101
- 5
0
votes
1 answer
Intellij: How to run all main() methods in a folder?
In IntelliJ there is a feature that runs all unit tests in a folder.
Is there any possibility to run all main() methods in the same way?

DerBenniAusA
- 727
- 1
- 7
- 13
0
votes
1 answer
How to call my_function in main & prompt user for input in main method; my_function accepts user input & concatenates in reverse order (Python 3)
I need to create a function that does the following for a class assignment:
- Write a Python function that will accept as input three string values from a user. The method will return to the user a concatenation of the string values in reverse…

Go-Go
- 17
- 5
0
votes
0 answers
Saving data on Firebase from Java Main Method don't work
I am trying to save data on Firebase from Java class with a main method. But it doesn't works.
I read a lot of posts but I can't get a solution.
My code is:
public static void main(String[] args) throws IOException {
// Init...
//
…
0
votes
1 answer
Why has my float value from getFloat() become 0.0?
I'm new on java is there any problem with my coding about float? because it became 0.0 and I didn't understand float much can you explain it? It happen on getFloat
This program to calculate cone volume
public class Cone_Volume
{
private int ri, hi,…

Miseba
- 11
- 2
0
votes
0 answers
How to change starting point of a C# program to another method?
I know that we can have many overload of Main method and have different methods.
But to run the C# class, class should have main() method with signature as public static void main(String[] args){} If you do any modification to this signature, the…

Hamed Sanaei
- 121
- 13
0
votes
0 answers
Error: Main method not found in class through the Page Factory Test (Selenium)
Building the framework on Java/Eclipse/Selenium WebDr/Page Factory to create my tests. But when running the test, it gives an error that says:
"Error: Main method not found in class, please define the main method as:
public static void…

Y_Sh
- 121
- 2
- 4
- 14
0
votes
3 answers
Intellij Idea - can't run a simple java class even though the main method is declared
I'm a self-taught coder who is new to both Java & Intellij Idea. I wanted to run a simple Java class called payroll in Intellij Idea Ultimate 2017.3
public class payroll {
public static void main(String[] args) {
int hours = 50;
double…

jack coltrane
- 71
- 1
- 2
- 6
0
votes
0 answers
non-static variable CAN be accessed by static main method through calling class object .how?
A nonstatic variable can be accessed through the static main method by creating an object of that class. how is this possible?
the object-oriented rule is non-static variable can not be accessed by static method because While we run a class, first…

B_Ali_Code
- 65
- 10
0
votes
3 answers
Could you technically call the string[] anything in the main method?
The header for the main method is
public static void main (String[] args)
Could you technically replace "args" with anything you want? Also, why is the parameter an array?

user147219
- 355
- 1
- 4
- 13
0
votes
2 answers
how to call Class mainMethod of another MavenProject from a controller[dispatchServlet] or any java class?
anyBody please share the knowledge.
i am facing this Exception
java.lang.ClassNotFoundException
from this project A
package com.demo.feed;
@WebServlet("/run")
public class ProjA {
String[] args={};
new com.om.demo.ProjB().main(args);
}
i…

John Adam
- 29
- 7