Questions tagged [main-method]

115 questions
0
votes
2 answers

Main method not found error in an applet

At my school I am using Notepad++ to write an applet, and I need to package it in a jar so I can sign it. I am attempting to do this with a batch file like this: CD C:\Users\name\Java\bin javac className.java jar cvfm className.jar Manifest.txt…
user2005938
  • 149
  • 1
  • 2
  • 13
0
votes
2 answers

Display a class named Time. (help troubleshooting code)

I need to design a class named Time. The class needs to contain: ■ Data fields hour, minute, and second that represent a time. ■ A no-arg constructor that creates a Time object for the current time. (The values of the data fields will represent the…
Mike L
  • 478
  • 5
  • 16
  • 29
0
votes
1 answer

Creat a main method to a quickSort class

This is my code so far. I need help to implement a main method that reads and sorts the supplied test files(unsorted1.txt and unsorted2.txt) public class quickSort extends DLList { public static > void…
0
votes
3 answers

Invoke the main method of a class in Mule

I have a Java class that writes data to a file every time you run the program. The Java class is written in the Mule project, and i would like to use a mule flow to invoke this Java class. So my question is - how can i invoke/start the main method…
The Georgia
  • 855
  • 6
  • 19
  • 51
0
votes
3 answers

".class expected" error when calling from main method from another class constructor

Im making a basic program that creates an object with certain attributes, and it works fine, but I need to load it as a independent program itself, so I created another class called Lanzador, which calls the constructor from the other class so that…
0
votes
1 answer

Does the Java main method start an infinite while-loop?

This question might be a really newbie one, but it's pretty confusing to me. I'm working on Java networking, and I'm curious as to the back-end of the main method. public static void main(String[] args) throws IOException I understand it that the…
Caffeinated
  • 10,270
  • 37
  • 107
  • 197
0
votes
1 answer

(Another) "non-static method cannot be referenced from a static context" issue

ERROR: non-static method cannot be referenced from a static context. In my case the method is called readFile(). Hi. I'm experiencing the same error that countless novice programmers have before, but despite reading about it for hours on end, I…
Default300
  • 21
  • 2
  • 6
0
votes
5 answers

Getting ExamQuestion@143c8b3 as print out in console

I have a have a class that has a method which takes a string. Then I have a method which returns the value of the above method. When ever I get the return value in my main class and print it the printed value is "ExamQuestion@143c8b3". How do I get…
logtech
  • 5
  • 5
0
votes
2 answers

Can a main method be placed in a parent class? And if so can a child object be instantiated inside that main method?

Let's say I have a class 'Person' and another class 'Survey' which extends person so Survey is the child class and Person class is the parent. Person was the first class I wrote and hence defined the main method there now since I have a child class,…
anonuser0428
  • 8,987
  • 18
  • 55
  • 81
-1
votes
1 answer

Why JVM cannot create object of class containing main method in order to access main method from that class, if it has the name of that class?

Well, I am not understanding that why JVM cannot create object of class having main method. If JVM can access main method by the name of that class then definitely it can create an object of that class right! But what is the reason behind accessing…
-1
votes
1 answer

how to store/return string value from a java main method?

I have a bash script that calls the java program . java java.org.test -h "abc" The class computes the value of a specific string and this value is required by the bash script. and I should not be printing this value on the console. How can this be…
-1
votes
1 answer

Why Are the Instance Variables Declared in the Main Method?

I'm learning Java on Codecademy and recently completed a project that calculates monthly payments for a car loan. The problem is that I don't understand the solution, and no one has responded to my question about it on the Codecademy forum. Why are…
smlisk0630
  • 15
  • 2
-1
votes
1 answer

C-Problem: How do I pass a main method argument to a string variable of the method?

I want to use a given string (given as console app argument) within the main-method and don't know how to assign the console app argument to a string variable which is declared and used in the main method: console: ~/substitution/ $ ./test…
ALL
  • 19
  • 5
-1
votes
5 answers

What is the difference between a constructor and a main method?

I've been using C# for a little while now, but mostly in Unity. I've only recently started just simply writing C# code in Visual Studio. I was simply playing around with implementing a Queue with an array and was doing a bit of research into…
Tom Ryan
  • 355
  • 3
  • 17
-1
votes
1 answer

What is a controller class in Java SE ?

Can someone explain the meaning and the position of a controller class in Java ? Why do we need to put the main method there ?
user10436512