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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.