Questions tagged [main-method]

115 questions
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
  • 3
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…
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
  • 101
  • 1
  • 2
  • 11
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
  • 55
  • 9
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
  • 305
  • 4
  • 11
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
  • 6
0
votes
3 answers

In languages where you have a choice, is it better to put the main function/method/code at the top or bottom?

When you're writing a program that consists of a small bit of main logic that calls a bunch of supporting functions, you can choose either put the main logic at the top of the file or the bottom (Let's assume the language allows either.) Which is…
Ryan C. Thompson
  • 37,328
  • 27
  • 87
  • 147
0
votes
1 answer

Determining frame size and other calculations in a paging system

I just had the following question in an exam and was a bit lost with how to solve it. How would I go about making the requested calculations?   "A paging system uses 48-bit addresses, each of which specifies 1 byte (B) of memory. The system has a…
KOB
  • 3,062
  • 1
  • 24
  • 60
0
votes
1 answer

No main methods, applets, or MIDlets found

When I run this a popup comes up telling me no main methods, applets, or MIDlets ound. Can someone tell me why please?--I am using jGrasp. I am trying to use main method and I haven't had this issue before. import java.util.*; import…
0
votes
1 answer

error: illegal start expression. when placing a final string` statement in the `public static void main` method

I have just started learning Java a few weeks ago. I'm trying to learn the key word final in java language. I wrote a final string statement in the public static void main method. However, the IDE is displaying the error: illegal start expression.…
Thor
  • 8,608
  • 10
  • 43
  • 113
0
votes
2 answers

Why not call the static method "main" of a class from another class?

If I have a class: public class HelloWorld { public static String main(String[] args) throws IOException { public createMessage(){ String message = "Hello World!"; } } return message; //return of the main static method } Why can't I…
ninjayoto
  • 623
  • 1
  • 6
  • 14
0
votes
6 answers

Main Method with int, Object and String [] args

I got the below code from internet and even though there are 3 main methods, if I run the app from command prompt: java MainTest 1 2 3 I would get the output: String main 1 public class MainTest { public static void main(int [] args) { …
Cuban coffee
  • 273
  • 2
  • 13