Solved

<No Main  classes found>

Posted on 2008-10-20
7
305 Views
Last Modified: 2013-11-23
Im trying to run this code throguh NetBeans IDE 6.1 and I get the fllowing error:

<No Main Classes found>

Any ideas?

import java.util.SCanner;

public class MarkVowels
{
      static Scanner sc = new scanner(System.in);

      public static void main(String[] args)
      {
            System.out.print("Enter a string: ");
            String s = sc.nextline();
            String originalString = s;

            int vowelCount = 0;

            for (int x = 0; x < s.length(); x++)
            {
                  char c = s.charAt(i);
                  if (            (c == 'A') || (c == 'a')
                              || (c == 'E') || (c == 'e')
                            || (c == 'I') || (c == 'i')
                         || (c == 'O') || (c == 'o')
                         || (c == 'U') || (c == 'u')  )
                     {
                        String front = s.substring((0, i);
                        String back = s.substring(i+1);
                     }
            }
            System.out.println();
            System.outprintln(originalString);
            System.out.println(s);
      }
}
0
Comment
Question by:GlobaLevel
  • 3
  • 2
  • 2
7 Comments
 
LVL 20

Accepted Solution

by:
chaitu chaitu earned 500 total points
ID: 22764282
lot of syntax errors;check this


import java.util.Scanner;
 

public class MarkVowels

{

      static Scanner sc = new Scanner(System.in);
 

      public static void main(String[] args)

      {

            System.out.print("Enter a string: ");

            String s = sc.nextLine();

            String originalString = s;
 

            int vowelCount = 0;
 

            for (int x = 0; x < s.length(); x++)

            {

                  char c = s.charAt(x);

                  if (            (c == 'A') || (c == 'a')

                              || (c == 'E') || (c == 'e') 

                            || (c == 'I') || (c == 'i') 

                         || (c == 'O') || (c == 'o') 

                         || (c == 'U') || (c == 'u')  )

                     {

                        String front = s.substring(0, x);

                        String back = s.substring(x+1);

                     }

            }

            System.out.println();

            System.out.println(originalString);

            System.out.println(s);

      }

}

Open in new window

0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 22764543
I appreciate your help..I should have checked it better there were some misppelings..however it never did get past line 3...the error I get is:" class MarkVowels is public, should be declared in a file named MarkVowels.java" Appreciate any help..
0
 
LVL 6

Expert Comment

by:javaexperto
ID: 22764557
Well your java file must be named as your class name, for example if your class is named
public class MarkVowels
then your file must be MarkVowels.java

At the other hand if your class is not public like this:
class MarkVowels
the name of your file doesn't matter.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 22764563
the code  pasted above is working or not?i already declared class as public and should be saved as
MarkVowels.java
0
 
LVL 6

Expert Comment

by:javaexperto
ID: 22764587
it's ok chaituu the credits are yours I only asked some trivial question.
0
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 22764623
ok understood.
0
 
LVL 10

Author Closing Comment

by:GlobaLevel
ID: 31508138
thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
solarwind tftp server 2 45
How to monitor the number of connections/threads being utilized on Tomcat 6.0 8 56
replace a word with other 1 40
difference of if loops 23 42
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now