Methods to be called depending on non null value

I am calling a classcreateTestFile. Depending on the value of the variable fetched, I want to call either the methodscreateFile1 orcreateFile2.

That is

1. If the value fetched for the variablefamily is null, then the program control should go tomte.createFile2(code); and

2. If the value fetched for the variablecode is null, then the program control should go tomte.createFile1(family);

My code is

createTestFile mte=new createTestFile();

try

{

mte.createFile1(family);

mte.createFile2(code);

}

catch (IOException ex)

{

ex.printStackTrace();

}

Could anyone please help me what updations to make in my code. At present I am not able to do so.

[1010 byte] By [sony_tja] at [2007-11-26 20:51:08]
# 1

Please start classes with a captial letter.

CreateTestFile mte=new CreateTestFile();

if (family==null)

mte.createFile2(code);

/* else ?*/ if (code==null)

mte.createFile1(family);

It's not clear from your specification if an else is required.

DrLaszloJamfa at 2007-7-10 2:16:11 > top of Java-index,Java Essentials,New To Java...
# 2

I'd go a step further.

if (family==null && code != null)

mte.createFile2(code);

/* else ?*/ if (code==null && family != null)

mte.createFile1(family);

floundera at 2007-7-10 2:16:11 > top of Java-index,Java Essentials,New To Java...