Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 315
  • Last Modified:

<No Main classes found>

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
GlobaLevel
Asked:
GlobaLevel
  • 3
  • 2
  • 2
1 Solution
 
chaitu chaituCommented:
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
 
GlobaLevelAuthor Commented:
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
 
javaexpertoCommented:
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
chaitu chaituCommented:
the code  pasted above is working or not?i already declared class as public and should be saved as
MarkVowels.java
0
 
javaexpertoCommented:
it's ok chaituu the credits are yours I only asked some trivial question.
0
 
chaitu chaituCommented:
ok understood.
0
 
GlobaLevelAuthor Commented:
thanks!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now