Win a copy of Head First Android this week in the Android forum!

Malcolm Featonby

Greenhorn
+ Follow
since Jun 18, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Malcolm Featonby

Must say I agree with Roger. Moving from the red tape of a mainframe environment into the brave new world of java developments provides you with a set of valuable skills which are often lacking in younger developers using newer technologies.
I have recently made the same move - 10 years CICS\COBOL\DB2 and am now developing in Java (last 3 years). I was fortunate in that a mainframe based project I was leading required a Java front-end which afforded me the opportunity to cross train. I think using you existing skills as leverage to getting a role with java opportunities rather then a pure java role is probably your best approach.
Interestingly, the one thing I have found is that (and excuse the generalization) the free spirited approach to change in development environments using younger technologies produce exactly the same problems all the red tape in the mainframe environment was put in place to avoid.
17 years ago
Sorry John - its quite a long winded response.
The key thing to remember is that java passes everything by value and
nothing by reference.


In this diagram (which I hope works on posting)each horizontal section represents a new set of values on the stack.
Objects are never passed to methods, only references to objects are passed to methods.
This is demonstrated in line 24 where the value held in "val", a reference to a new instance
of Value() is assigned to the reference variable "v". This results in "v" holding a
reference to the new instance of Value(). It does not have any impact on the
instance of Value() previously referenced by this local variable.
so :
- first() has an int called i with a value of 5 and an instance of Value() called v.
- second() has another int also called i which is a parameter variable and so is assigned the value passed on the call. This int's value is subsequently changed to be 0 on line 21. There is also a parameter variable which is a reference to a Value() instance. This variable holds a reference to the instance of Value() created on line 13. On line 22 we use this reference variable to change the value of i held in the instance of Value() to be 20. On line 24 we then change the value of the reference variable to refer to a new instance of Value().

It is important to distinguish between references to objects and the objects themselves.
Something that is well illustraded by your code example.
I hope this helps,
Malcolm
18 years ago
If you wanted the actual day change the SimpleDateFormat constructor call to this.
SimpleDateFormat sdf=new SimpleDateFormat("EEEEEEEE");
18 years ago
Thanks Stan,
I feel appeased.
I agree with Micheal however. If your starting out then Java is by far the best choice.
Get a good grip of the basics in a friendly environment before waging war with

hair and warts

18 years ago
Sorry - - my first response won't help you unless you can relink the C module as a DLL. Even then I think you are going to have to move the processing you require into another function.
18 years ago
Sorry Sheriff Cindy,
Should have read the manual shouldn't I.
Thanks for the href Alistair.
18 years ago
Edward,
How about writing a small piece of wrapper code in C which is "JNI aware" as it were. This C wrapper function could then call the main() method you are after. Likewise you could write a simple Java class that wraps the call to this and thereby have a simple interface for your java code and no changes required to your C code.
Once this is working I am sure you could get clever with it and have the name of the module containing the main() method passed in from the Java wrapper class thereby allowing you to call main() in pretty much anything.
Hope this helps.
Malcolm
18 years ago
Hi,
It can be done but typically "- insert anti - Microsoft comment here -".
This will work on Windows 2000 machines. I have not tested it on anything else but I would imagine it should work on XP too.
First you need to make sure that Command Extensions and Delayed Expansion are enabled in your command shell. To do this make sure that the
following entries in your system registry (use REGEDT32 to check) are present and enabled (set to value 0x1).
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\DelayedExpansion
and
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\EnableExtensions
(You can also use a switch when running CMD.EXE to do this "CMD /E:oN /V:oN").
Once this is done the following script will do the same as the linux/unix script.
FOR %%I IN (*.jar) DO (
SET CLASSPATH=!CLASSPATH!%%~fI;
)
Hope this helps.
[ edited to disable the smilies -ds ]
[ June 21, 2003: Message edited by: Dirk Schreckmann ]
18 years ago
No idea I am afraid, I tried it and it workds fine???

Are you sure this is a full excerpt from your code ?
18 years ago
Do you know of any good articales in this regard Alistair ?
I would be interested to find out more.
Thanks
18 years ago
Hey easy,
There are still some of us old timers around who remember what Cobol looks like.
18 years ago
Aakash,
Its a class without a name. It is used quite often for Event Listeners in Swing.
A simple example is shown in the code below:

The sample is just a very complicated way of saying Hello World. However the key is in the aClass constructor.
Here we instantiate a class - however the class is not named. Rather we refer to an Interface and we provide the implementation for the interface "inline" or as part of the aClass source code. We have created a new class, however because this class has no name it is refered to as an anonymous class.
Hope this helps,
Malcolm
18 years ago
Hi Prakash,
I have been working internationally as a consultant for a number of years and in the last couple has started consulting in java.
I would suggest deciding what kind of job you are after before you spend loads of money on exams. Assuming you plan to stay with java then I think that the Java Developer Exam and\or the Java Architect Exams are good if you wish to get some background into designing and building Enterprise based solutions.
I disagree that the Java Certification is not being done or worth doing. I would certainly take Java Certification into consideration when looking at a future employee. However commercial experience is always going to be the deciding factor I am afraid.
I hope this helps and good luck finding a job.
Malcolm
18 years ago
Hi Anneke,
The key here is public class. A Public class must be in a source file with the same name as the class itself and there can only be one public class (excluding inner classes) in the source file.
However there can be any number of classes in the file that are not public. Further to this a package class does not have to be held in a source file with the same name as the class. (i.e. classes X, Y and Z can be held in file ABC.java and will compile fine provided that X, Y and Z are not public.)
/* A Class */
//public
class ABC {
public ABC() {
System.out.println("ABC Constructor");
}
}
/* Another Class */
//public
class DEF {
/* Local Variables */
ABC myABC;
DEF() {
myABC = new ABC();
System.out.println("DEF Constructor");
}
public static void main(String[] args) {
DEF thisClass = new DEF();
}
}
(Copy and paste the above into notepad (or whatever) save it as whatever you like .java and then compile it. It will work fine. Then uncomment the public in front of ABC class and see what happens. Then uncomment the public before DEF and see what happens. Then rename the file.)
I found when I did the exam that the best way to get answers to questions like these is to write a simple sample class to see what happens.
Good luck for the exam.
Malcolm