无法从主打印无效方法

时间:2018-09-26 22:55:07

标签: java printing void anagram

我做了一个main方法,插入排序并希望它在我的测试器类中正确打印出来。我知道它无法打印,因为它是使用数组的void方法,并且我需要将其作为要打印的字符串,我只是不确定要在方法或打印行中对其进行编辑以使其可行。

方法

[ServiceContract]
public interface IKioskMessageService
{
    [OperationContract]
    string SendKioskMessage(string message);
}

public class KioskMessageService : IKioskMessageService
{
    public string SendKioskMessage(string message)
    {
        return string.Format("Message sent: {0}", message);
    }
}

class Program
{
    static void Main(string[] args)
    {
        Uri baseAddress = new Uri("http://localhost:8080/sendKioskMessage");

        // Create the ServiceHost.
        using (ServiceHost host = new ServiceHost(typeof(KioskMessageService),baseAddress))
        {
            // Enable metadata publishing.
            ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
            smb.HttpGetEnabled = true;
            smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
            host.Description.Behaviors.Add(smb);

            // Open the ServiceHost to start listening for messages. Since
            // no endpoints are explicitly configured, the runtime will create
            // one endpoint per base address for each service contract implemented
            // by the service.
            host.Open();

            Console.WriteLine("The service is ready at {0}", baseAddress);
            Console.WriteLine("Press <Enter> to stop the service.");
            Console.ReadLine();

            // Close the ServiceHost.
            host.Close();
        }
    }
}

测试器

public static void insertionSort(String[] inputList) 
        {
            OrderStrings c = new OrderStrings();

            for (int i = 1; i < inputList.length; i++)
                {
                    String index = inputList[i];
                    int j = i;
                    while ( j > 0 && c.compare((sort(inputList[j])), sort(inputList[j-1])) > 0)
                        {
                            inputList[j] = inputList[j-1];
                            j--;
                        }
                    inputList[j] = index;


                }
        }

0 个答案:

没有答案