could not find the main class programm will exit - error

could not find the main class programm will exit - error

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(); }

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
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
programm
Multiplication import java.util.*; class MatrixMultiplication{ public static void main(String[] args){ Scanner input = new Scanner(System.in); int
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
Class and interface in same file and accessing the class from a main class in different package
Class and interface in same file and accessing the class from a main class... a class named CantFly in same file. A main method CheckAnimal.java. Below... class CheckAnimals { public static void main(String[] args) { Animal
Class and interface in same file and accessing the class from a main class in different package
Class and interface in same file and accessing the class from a main class... a class named CantFly in same file. A main method CheckAnimal.java. Below... class CheckAnimals { public static void main(String[] args) { Animal
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
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
programm
applicationDidEnterBackground Exit
applicationDidEnterBackground Exit  Hi, Provide me full code of applicationDidEnterBackground exit(0). Thanks   Hi, Here is the complete.... */ exit(0); return; } Thanks
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
write a programm using java
write a programm using java  print the following using java programming
looping programm of sum
looping programm of sum  s=1+2/12+1+2+3/12*3+1+2+3+..... n
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
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 exit gremlin console
how to exit gremlin console  Hi, I am working on gremlin and don't know how to exit from the console correctly? What is the command? Thanks   Hi, to exit from the gremlin console type following command: :exit
how to exit gremlin console
how to exit gremlin console  Hi, I am working on gremlin and don't know how to exit from the console correctly? What is the command? Thanks   Hi, to exit from the gremlin console type following command: :exit
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
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
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
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
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
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
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
Difference between abstract class and an interface
will find the difference as follows : First difference, an abstract class...Difference between abstract class and an interface The difference between abstract class and interface is one of the most popular question in the interview
class
class  Is a class a subclass of itself
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
Class
there are two classes has been used except the main class in which the main function.... First class is another and second is the main class which name is Construct... Class, Object and Methods     
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
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
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
class
is a class to represent a country in medal tally. It has an attribute of country... medals. In this class, you should also define constructors, and assessor, mutator methods. Task 2 MedalTally.java is a class to model a medal tally, containing
PHP Class Object
PHP Class Object: In object oriented programming a class can be an abstract data type, blue print or template. You could consider the name of a class as noun like name of a person, place or thing.  For example Fruit is a class, where
java programm
format of the input data â?? the program writes an error message to the standard
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
what is the size of java class
what is the size of java class  Could anyone tell me how to find the size of the class given below. public class Sample { private int x; private int y; private char ch; public static void main(String[] args) { Sample
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
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
Change JPanel background color from mouse entered/exit event
Change JPanel background color from mouse entered/exit event  I have a JPanel with a grid layout and I populated it with anonymous JPanels... JPanels to see if I could make it work as a test to just System.out.println("test
main function
main function  Give me the description of public static void main(Strings args
main() method
main() method  Can we define two main() methods having same parameter but with different return type in a program

Ads