Re: Question:



If this program isn't for a course or isn't an exercise of some sort,
the following paragraph does not really apply to you.

I'd hate to discover I was cheating you out of learning for a course by
telling you the answer, but maybe this will help you learn the
fundamentals better.

I can't tell what you're asking in question 1, have you thought about
this thoroughly? Are you trying to run both with one command?

If so, you could possibly put in the first one, the one you want to run
from the command prompt, a line telling the other class to run.

That is, if your classes were something like

public class A
{
public static void main(String[] args)
{
System.out.println("Class A is running");
}
}

and an identical one with B instead of A, you could put instead for A:

public class A
{
public static void main(String[] args)
{
System.out.println("Class A is running");
B.main(args);
}
}

To see whether there was an input or not, you can do this: pretend your
code looks like the following, and has an additional
isPalindrome(String s) method.

public class B
{
public static void main(String[] args)
{
if(args == null)
System.out.println("No input!");
else
{
String wholestring = "";
for(int i = 0; i < args.length; i++)
wholestring += args[i];
if(isPalindrome(wholestring))
System.out.println("A palindrome");
else
System.out.prinltn("Not a palindrome");
}
}
//also there should be a boolean method
"isPalindrome(String)"
}

.



Relevant Pages

  • Re: Multithreading - writing to same file C#
    ... > to log the response of the DAL methods and log ... > public class yyy ... > private Mutex mut = new Mutex; ... > public static void Main ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Is it possible to "decipher" Java serialization data?
    ... that saved a class called "UserInfo". ... public class save { ... public static void main{ ... public String getUserName() { ...
    (comp.lang.java.programmer)
  • Re: Parse string expression and get result
    ... public class FuncEvalFactory ... public static IFuncEval Create(string expr) ... CompilerParameters param = new CompilerParameters; ... public static void Main ...
    (microsoft.public.dotnet.languages.csharp)
  • Spawned process output
    ... public static void main ... StreamConsumer errFromProcess ... public class StreamConsumer extends Thread ... while (!isDone) ...
    (comp.lang.java.programmer)
  • Re: When to use float (in teaching)
    ... public class Main ... {public static void main(final java.lang.Stringargs) ... In both cases float and double are working as should be expected. ...
    (comp.lang.java.programmer)