Permutation using java - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Permutation using java

I have this class called Permutation,and a test of it called PermutaionTest...but I try to run it it gives me an error:Exception in thread "main"java.lang.NoClassDefFoundError:test

What could be the problem??Kindly help.
Thank you


public class Permutation
{
public void permuteString(String beginningString, String endingString)
{
if(endingString.length()<=1)
System.out.println(beginningString+endingString);
else
{
for(int i=0; i<endingString.length(); i++)
{
try
{
String newString=endingString.substring( 0, i)+ endingString.substring ( 1+1);

permuteString(beginningString+endingString.charAt(i), newString);
}
catch ( StringIndexOutOfBoundsException exception)
{
exception.printStackTrace();
}
}
}
}
}


import java.util.Scanner;

public class PermutationTest
{
public static void main( String args[])
{
Scanner scanner= new Scanner(System.in);
Permutation permutationObject= new Permutation();

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

String input=scanner.nextLine();

permutationObject.permuteString("", input);
}
}
Sign In or Register to comment.