Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners could not find the main class programm will exit - error

Have Programming Question? Ask it here!
 
 
 


Rajkumar.D
could not find the main class programm will exit - error
2 Answer(s)      3 years and 10 months ago
Posted in : Java Beginners


when i tried to run the below mentioned programmed it gives a error states - could not find main class programm will exit.

class Car { String name: String Color: int num: } public void accept(){ name = "BMW"; Color = "Block"; num = 1234; } public void disp(){ System.out.println("Name of the Car is: " + name); System.out.println("Color of the Car is: " + Color); System.out.println("Number of the Car is: " + num); } public static void main (String ars[]){ Car c = new Car(); c.accept(); c.disp(); }


Advertisement
View Answers

October 29, 2010 at 2:11 PM


Hello Friend,

Try this:

class Car { String name=""; String Color=""; int num=0;

public void accept(){ 
    name = "BMW"; 
    Color = "Block"; 
    num = 1234; 
    } 
    public void disp(){ 
    System.out.println("Name of the Car is: " + name); 
    System.out.println("Color of the Car is: " + Color);
    System.out.println("Number of the Car is: " + num); 
    }
    public static void main (String ars[]){
        Car c = new Car();
        c.accept(); 
        c.disp(); 
        } 
        }

Thanks



October 29, 2010 at 2:12 PM


Hi Friend,

Try this:

class Car {
    String name="";
    String Color="";
    int num=0;

    public void accept(){ 
        name = "BMW"; 
        Color = "Block"; 
        num = 1234; 
        } 
        public void disp(){ 
        System.out.println("Name of the Car is: " + name); 
        System.out.println("Color of the Car is: " + Color);
        System.out.println("Number of the Car is: " + num); 
        }
        public static void main (String ars[]){
            Car c = new Car();
            c.accept(); 
            c.disp(); 
            } 
            }

Thanks



Related Tutorials/Questions & Answers:
.jar file keeps giving me " could not find the main class". Program will exit.
.jar file keeps giving me " could not find the main class". Program will exit... click on it, it gives me the message" could not find the main class. Program... netbeans's project properties clearly sets testing2.hihi as my Main class and I have
could not find a getter for id in contact class
could not find a getter for id in contact class   could not find a getter for id in contact class
Advertisements
programm
Multiplication import java.util.*; class MatrixMultiplication{ public static void main(String[] args){ Scanner input = new Scanner(System.in); int
is this programm efficient to find the day of the given date . can it be more normalized ?
is this programm efficient to find the day of the given date . can it be more normalized ?  #include <stdio.h> int main(void) { int dd,mm,yy,i,leap=0,ordi=0,odd_years,month_days= 0,total ; char week[7][10
STRUTS 2 Could not find action or result
STRUTS 2 Could not find action or result  hiii..i am new to struts 2... on my log: WARNING: Could not find action or result There is no Action... java.sql.Connection; import java.sql.DriverManager; public class ConnectionProvider
return 0 vs exit 0
return 0 vs exit 0  what is the difference between return 0 and exit 0 in c? i could not find any difference in their behaviour (both terminates the process execution) in a program
applicationDidEnterBackground Exit
applicationDidEnterBackground Exit  Hi, Provide me full code of applicationDidEnterBackground exit(0). Thanks   Hi, Here is the complete.... */ exit(0); return; } Thanks
main function defnition in class - Java Beginners
main function defnition in class  why do we use public infront of a main function   Hi friend, The main method is similar to the main... and will subsequently invoke all the other methods required by your program. The main method
write a programm using java
write a programm using java  print the following using java programming
menu drive programm in java
menu drive programm in java  calculate area of circle, square,rectangele in menu driven programme in java
menu drive programm in java
menu drive programm in java  calculate area of circle, square,rectangele in menu driven programme in java
looping programm of sum
looping programm of sum  s=1+2/12+1+2+3/12*3+1+2+3+..... n
Find Month name using DateFormatSymbols class.
Find Month name using DateFormatSymbols class. In this tutorial, you will learn how to find the month name using DateFormatSymbols class. The class... DateFormat and SimpleDateFormar use DateFormatSymbols class to encapsulate
top 20 basic programm of java
top 20 basic programm of java  what is the top 20 rule to learn the basic of java.   Learn Java through the following links: http://www.roseindia.net/java/ http://www.roseindia.net/java/beginners/index.shtml
construction in java programm
construction in java programm  p*(1+r/100) at the end of year 200 p is population r is growth rate class name: population Data members : float p,r Member methods: population (int a, int b):Constructor to initialize p and r
NoClassDefFoundError: Could not initialize class com.net.plugin.HibernatePlugIn - Struts
NoClassDefFoundError: Could not initialize class com.net.plugin.HibernatePlugIn  Could not initialize class com.net.plugin.HibernatePlugIn... But its giving error such like NoClassDefFoundError: Could not initialize class
how to write a programm in C for included code below
how to write a programm in C for included code below  Here is my question 'how to write a program in C that runs your sql-xml application session... terminated with a ";" Enter ".quit" to exit sql-xml> cancelled orders
cannot find symbol class array queue--plzz somebody help..
cannot find symbol class array queue--plzz somebody help..  import java.util.*; public class Test { public static void main(String[] args) { ArrayQueue<String> q = new ArrayQueue<String>(6); System.out.println
how to pass variable from simple java main class(not servlet) to the jsp page?
how to pass variable from simple java main class(not servlet) to the jsp page?  I have a simple Java class in which I invoke a call to a JSP page... from the simple Java class to the JSP page. How can I do that? Here is my
java programm
format of the input data ?? the program writes an error message to the standard
main method
is a class method. void- It indicates that the main() method has no return value...main method  psvm(String args[]) what does this arguement in paranthesis denote?   Hi Friend, public-It indicates that the main() method
Interface Vs Abstract Class
Interface Vs Abstract Class       There are three main differences between an interface and an abstract class: At the same time multiple interfaces can be implemented, but only
could someone help in this ........
could someone help in this ........  dear Sir/Mrs I'll be thankful for helping me on this ....... write a program that reads 10 numbers. find the largest number and count the occurrence of the largest number from a declared
Can a main method be overloaded?
Can a main method be overloaded?   Hi, Can a main method be overloaded? thanks,   Hi, Yes, In Java program we could having multiple number of main() methods with different Signature and implementation in the class
main method
main method  Why is the java main method static
main method
main method  What is the argument type of a program's main() method
J2ME Command Class
J2ME Command Class       In the given J2ME Command Class example, we have set the various...;exit and item to the Midlet. And also set the priority for it such as 1, 2
main() method
main() method  Can we define two main() methods having same parameter but with different return type in a program
main function
main function  Give me the description of public static void main(Strings args
About Main
About Main  can u create the object of one interface ? But i can able to create the abstract class through anonimous inner class.similarly can i
About Main
About Main  can u create the object of one interface ? But i can able to create the abstract class through anonimous inner class.similarly can i
Can I have multiple main() methods in the same class?
Can I have multiple main() methods in the same class?  Hi, Can I have multiple main() methods in the same class?   Hi, No, We cann't use multiple main() method within the same class. If we do this then the program
Could someone Possibly help me with this
Could someone Possibly help me with this   think of a number and allow the user to guess it import java.util.*; public class ThinkNumber { public static void main (String args[]) { //generate number in range 1
could not connect to the server - JDBC
could not connect to the server  Hii sir, I am working with a JBDC program now. Now i am trying to host it. when i am trying to connect to the remote MySqL server, i got an exception like
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  ... suggest me how can i resolve it. Exception in thread "main" org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  ... suggest me how can i resolve it. Exception in thread "main" org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  ... suggest me how can i resolve it. Exception in thread "main" org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  ... suggest me how can i resolve it. Exception in thread "main" org.hibernate.MappingException: could not instantiate id generator
find the factorial
find the factorial  how to find the factorial through the while loop?   class FindFactorial { public static void main(String[] args) { int value = 5, factorial = 1, temp = value; while
public static void main
public static void main  what is mean public static void main?   public-It indicates that the main() method can be called by any object. static-It indicates that the main() method is a class method. void- It indicates
main() syntax - Java Beginners
] [import statements] [class declaration] [main() method] For Example: package roseindia; import java.lang; class Hello{ public static void main(String...main() syntax  Hi, I would like to know the complete structure
find and substring
find and substring   **import java.io.BufferedReader; import...; import java.util.regex.Pattern; public class Findandreplace { BufferedReader... BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter find
Main function.. - Java Beginners
Main function..  Hi Friend.. public static void main(String args[]) What does it mean...public - static - void - main -(String args[]) Can u plz...   Hi friend, public: The method can be accessed outside the class
could anyone please help with the code.
could anyone please help with the code.  protected void doPost... the details to the bean class */ userLogin_bean obj=new userLogin_bean...(request, response); } } could anyone please check the code. If i enter
could any one help me?
could any one help me?  I'm a student in the faculty of computer and information science we will make graduation project "taxi dispatcher" we need to use mobile "x6 nokia" in car and send the coordinate of car through gps which
Main method overloading
Main method overloading  Can we overload main()method
why not float main?
why not float main?  why should the main be int or void?why cant it be float or char? why int main()?why not float main()?or char main
why not float main?
why not float main?  why should the main be int or void?why cant it be float or char? why int main()?why not float main()?or char main
Please find me a solution that
static void main(String[] args) { boolean exit=false...Please find me a solution that   Write a java program... must have the following: Two classes named "Area" and "AreaTest". Class "Area
Main memory is also known as
Main memory is also known as   Main memory of a computer is also known
 

 

 

DMCA.com