Win a copy of Microservices Testing (Live Project) this week in the Spring forum!

Paul Ze

Greenhorn
+ Follow
since Mar 14, 2002
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 Paul Ze

Thanks good point. Like I said this is good practice for me and its good to get the feed back. I have added to the code above but am getting an expected identifier message in my IDE ( which
is visual J++)
Am I on the right track
import java.io.*;
import java.util.*;
public class Test
{
public static void main( String a[] )
{
File file = new File( "c:\\windows\\desktop\\" );
File[] files = file.listFiles(); // use listFiles(filter) if you need
File[] jpgfiles = file.listFiles
(new FilenameFilter(){
for(int i = 0;i<files.length();i++) {
accept(file,files[i].getName()){
StringTokenizer st1 =new StringTokenizer (files[i].getName(),".")
String tok1 = st1.nextToken();
String tok2 = st1.nextToken();
if(tok2.equals("jpg")
return true;
else
return false;
}
}
});

for( int i = 0; i < files.length; i++ )
{
if( !files[i].isDirectory() )
System.out.println( "File : "+files[i].getName() );
// instead of above do files[i].rename("string");
}
}
}
20 years ago
Thanks that seems simple enough. The plan is for me to email the application to the user over the internet, aol to be exact. Presuming they dont have a virtual machine on their hard drive the best way to do that would be to make it an applet and sending the class and corresponding html file to the user. Then i would probably need a GUI so that the user can input the directory to look into and to create the new name for the files. Am I on the right track?
Athough i was certified in March i learned enough to pass the exam. But haven't had any real practice using it. So I'm not yet comfortable with
it. This is excellent proactice for me
20 years ago
I recently passed the Java 2 Certification in March. But I still haven't done any real programming in it except for practice. But i was talking with a friend online. She has 3,000 jpg files on her computer that she wants to rename in numerical order eg. picture1 picture 2 etc etc.
Is there an API in java that would do that? What would be the best way to go about creating a java application to do that?
My first thought would be to import all these files into a collection then use a for loop to rename each in a numeric order like picture 1 picture 2.
Any ideas out there?
20 years ago

Originally posted by Ian Bushmaster Cockcroft:
Does anyone know of a site where I can get mock exams similar to the sun certification exam?
thanks


It costs $75 but it contains questions that are most similar to the real thing.Sun Practice Exam
Now that I have passed the java programmer certification exam. Any suggestions on what would be next to learn. Here's my situation.
I'm 52 years old. I currenty work for a Market Research firm. I was introduced to the wonderful world of programming 2 and half years ago when without having any prior experience in programming I was promoted to the position. Quancept and Quantum are the software tools used in the Market Research Industry.
During these past two and half years i have been able to use the tuition reimbursement benefit of my newly acquired postion to pursue and assoiciates in Computer Technology.
However 6 months ago in a cost cutting measure they eliminated my position. ( I was not getting enough billable programming hours.) So I back doing what i did before for the company, but at the same programer salary.
Anyway in the last six months i have been learning a new programming language....JAVA...and started job searching. My question simply is after my certification what else would be the most marketable skill i could acquire in conjunction with JAVA programming.
[Edited by Val. Removed the "What' s next continued...." post]
[ March 23, 2002: Message edited by: Valentin Crettaz ]
Ok I'm a greenhorn. How does one acquire the other monikers?
20 years ago
yes you will get a printout stating how many you got correct and the percentages in each area. I just got back from my exam and scored 71
It is a wonderful feeling when the printer kicks in after the exam and you read PASS. I scored 71. Actually thought I did better than that...but a pass is a pass is a pass. yippee or in the language of this site....EEEEEEEEE AYYYYYYYYY!
20 years ago
Thanks Duncan,
I needed to hear that. I scored 91 on my third run through of the practice exam. I'm a bit nervous about the real one since i have actually no real time practice actually programming in java except for a few exercises in Deitels book How to program in Java (wrote a Knight's tour game based on one of the exercises in chapter 7).
I'm 50 years old and programming is a planned second career for me. I chose java as the language to learn. I do have 2 years of expereince in programming where i currently work... a market research firm..which uses a language called Quancept, a procedural language that sets up telephone interviews to be displayed on a computer screen. I was promoted and in-house trained for the position having no prior progamming experience. But with the economy turn down i haven't had any programming projects since last july (not enough billable hours to go around)
I still work for the company but they created a monster because i fell in love with programming. So im not gonna sit around and wait for them to give me programming work. I'm retooling and learning other programming languages....like java...then will see what jobs are out there!!
Well one last review...then call it quits and let the chips fal where they may.
isn't answer d illegal too because it is throwing a different (in this case more exceptions) exception than the overridden one. I thought an overridding method can't throw more exceptions than the method it overrides but it can throw less.
Here is yet another question from the Sun Learning center practice exam site.
Given:
1. public class juju {
2. public static void main(String [] args) {
3. double z = 0xFFFFFFFC;
4. int i = 0xFFFFFFDF;
5. double x = z * i;
6. System.out.println(x);
7. }
8. }
What is the result?
A
Compilation fails because of an error on line 3.
B
Compilation fails because of an error on line 5.
C
Compilation succeeds and the program prints "-37.0".
D
Compilation succeeds and the program prints "132.0".
The answer is D because both of those numbers are negative numbers. But how do i know that those two numbers are negative from the reading the code?
Alvin I hear ya. My exam is scheduled for Monday morning. My brain has already exploded a couple of times. I took a class as an intro to java in September. I've been preparing for the certifcation exam since January. I don't know how much more my brain can hold.... and still I'm not sure if I know enough to get 36 questions right on a 59 question exam.
Thanks that is what i thought as i was writting the first post...check out my other question on local variables
Here is yet another practice exam question from Sun's learning center web site:
Given:
1. public class SaySo {
2. public static void main(String [] args) {
3. int o = 2;
4. boolean p = true;
5. boolean [] z = new boolean[2];
6. p = z[(o-1)];
7. System.out.println(p);
8. }
9. }
What is the result?
A
Compilation fails.
B
Compilation succeeds and the program prints "true".
C
Compilation succeeds and the program prints nothing.
D
Compilation succeeds and the program prints "false".

The answer I gave and the site said was correct is D. However shouldn't the code as written fail to compile being that local variables are not automatically intialized. Since the array boolean [] z was not explicitly initialized to false wouldn't that cause a compile error?
I'm doing the practice exam at the Sun Learning center. Here is one of the questions.
When is the object created at line 3 eligible for garbage colection?
a. It is eligible after line 7
b. It is eligible after line 8
c. It is eligible after line 9
d. It is not eligible for garbage collection in this method.

1. public class TipTop {
2. public String tipper() {
3. Object tip = new Object();
4. String[] top = new String[2];
5. top[0] = "this";
6. top[1] = "that";
7. tip = top[1];
8. top[1] = top[0];
9. tip = null;
10. return top[0];
11. }
12. }
The answer I entered is C. But the site says that the correct answer is A because there are no valid references left to the object. Am i missing something. Or is it because tip now refers to a different object in line 8.