Thought and Freedom

Articles for those who think. By Terry Pearson

Archive for the ‘Java’ Category

Java Interview Questions

with 7 comments

Computer science students learn about a wide range of topics during their time at school. There are several things a programming student should know regarding Java. There is a great review for Java programmers found at http://www.interview-questions-java.com/. These are questions and answers to many Java interview questions. It is also a good refresher for those experienced in the Java language.

read more | digg story

Written by Terry Pearson

May 11th, 2007 at 11:10 pm

Posted in Java

Test your Java Skills

without comments

I am currently in a Java class at my university. This is a language that I think is just wonderful. Java (and  .NET languages) truly utilizes Object Orientated Concepts to the fullest.

When you are learning a language, it is sometimes difficult to test your skills. You certainly think you know a lot about the language, but how do you know that you are an expert? Possibly the best way, besides certification, is to take online tests on the language of your choice.

A great place to look for these online tests is on text book publisher websites. For example, my textbook entitled “Introduction to Java Programming” by Daniel Liang, has a website with source code and tests available to all. This tool makes it very easy to assess your current skill set, and helps identify areas in which you need to improve.

Written by Terry Pearson

April 4th, 2007 at 6:41 pm

Learning about Applets

without comments

Web programming can be as simple or as complex as you want it to be. The easiest web publication is a simple text file. You could upload it to the web and it would show up as just text.

From the text file, you could progress to a simple HTML file. This is basically a specially formatted text file.

As complexity increases, so do your options and features. Languages like Coldfusion add another layer to the complexity. But, they open the door to many more uses. PHP would probably come slightly after Coldfusion.

Eventually you come to a category called “Applets.” I am sure you have heard of them, but they can be seen as mysterious in nature. They are Java Programs that are compiled and all, and told to run within the confines of a web browser.

Applets are just past the edge of the “scripting universe.” In a way, they are the bridge between compiled code and scripts. They themselves are compiled, but closely relate to their scripted environment.

Learning how to program applets can be rewarding and can extend the usefulness of your website. My advice is to start by going to WebChalkboard’s lessons on applets. They are concise and to the point and will get you started in no time.

After you go through the initial tutorials on WebChalkboard, go over to Sun’s own applet tutorials. Sun’s tutorials will show you how to use pictures, sounds and more. It will take your applet building to the professional realm.

Once you know the basics, applets can be a fun way to create an interactive and informative website!

Written by Terry Pearson

February 3rd, 2007 at 2:46 pm

Display a Double with two decimal places in Java

with 2 comments

I just spent the longest time trying to find the easiest way to make a double display two decimal places in Java.

Basically, I wanted to output money information, and it would look better if the money data says “$5.00″ instead of “$5.0″ as is sometimes the case. There are so many “solutions” to this, that it is difficult to wade through them all.
The best solution I encountered was relatively easy. You can find it in Sun’s Java forums.

import java.text.DecimalFormat;

double d = 8.9909879;

DecimalFormat dFormat = new DecimalFormat(0.00″);

String formattedString = dFormat.format(d));

The above code will format a string that has two decimal point precision. It will give the number 8.99 instead of 8.9909879.

Written by Terry Pearson

January 28th, 2007 at 1:48 am

The most important reference document for Java

without comments

If you are new to Java, or are more experienced than anyone, you still need to look up stuff. Every developer has moments in their language of choice where they just can’t solve a problem. Or, they may just be looking for an easier way. Don’t be ashamed to look up a result. Doctors do it all the time. Engineers do it. Why shouldn’t programmers do it as well. It helps us all develop cheaper, faster, and smarter code without reinventing a wheel that someone else already created.
To make life easier for us all, Sun publishes some of the best documentation that I have seen for a programming language. In a very clear layout, all functions in the Java API are laid out in one place. Each class has easy to understand instructions on the class in general, it’s interfaces, classes, exceptions, and errors. This is all published on Sun’s website as the Java API Specifications.

I knew about this for a while, but just today realized it’s complete usefulness. This has quickly become my favorite “book” on Java programming. To top that off, it is freely available online.  This is a useful set of documents for any Java coder.
Sun even caters to the more graphically inclined persons, the documentation can be formatted in the form of a tree (extending from the package).

Also, you can use the “index” link to show an entire “glossary” for a package. This can be a speedy way to get results when using the find function on your web browser.

So, whether you are a Java Newbie, or a super Java coder, using the API specs will help improve your programming ability.

Written by Terry Pearson

January 26th, 2007 at 12:31 am

High Quality Installers for Your Application

without comments

Now days, every program you download comes with an “installer.” Without such a program, your new application looks unfinished and unprofessional.

However, most computer science students are not taught how to use such a program. They are never told where how to setup an installer to make their finished works look professional and classy.

Last year, I took my software engineering class. We developed an instant messenger application in VB .NET. It was the biggest project that myself or the other two members of my group had ever undertaken.

When it was time to roll out the finished application, we made sure it looked professional. One step we took was to use a program to create an installer for our software.

The solution we used was called Inno Setup. It was very easy to use, and very professional looking. Most of our classmates were impressed.

Even though Inno Setup worked great, I have recently discovered an even better and more versatile installer. This one is known as Nullsoft Scriptable Install System (NSIS). This adds dozens of great features including the ability to check for required supporting software (like the Java Runtime Environment) and the ability to download online updates.

You can read much more about this great application at http://nsis.sourceforge.net/.

Written by Terry Pearson

January 23rd, 2007 at 11:53 pm

Posted in Java,Programming

Learn Java Swing

without comments

COBOL Programmers Swing with JavaIf you talk to a lot of programmers these days, you will hear an increased number of conversations about Java. With the open sourcing of parts of the actual language, and the strong support that Sun Microsystems has pledged to help an Open Source Java succeed, you can be sure that Java is likely to dominate the programming industry for the next several years.

For beginners, Java complicated to learn. However, beginners can greatly benefit from learning Java. By becoming familiar with the language, a new programmer will learn a great deal about object orientated programming.

As with any language, there are usually several good sources of learning that can be found on the internet. There are also several “not so great” sources. Sometimes it is hard for learners to determine the right place to start learning.

I would highly recommend Sun’s Java tutorial site located at http://java.sun.com/docs/books/tutorial/.

Another site that gives a basic introduction to the Java Swing Library (A graphical user interface library) can be found at http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/.

Written by Terry Pearson

January 6th, 2007 at 12:06 am

Java SE 6 Released.

with 2 comments

Sun Microsystems announced that they just released Java SE 6. Depending on who you ask, this is a great thing, or just so so.

Joey deVilla, from Global Nerdy, was not impressed with Java 6. Of course, he has made a significant effort to avoid getting sucked in to the Java mindset. I thought it was funny that he said there is something wrong with a language that requires you to make a class for a simple program like “Hello World.”

I personally disagree with DeVilla, but I understand where he is coming from. If you moved from a type of language that does not use classes, or uses them infrequently, it would be difficult to get into the habit of creating a class for such a simple program.

I am very excited about the updates to Java, no matter how trivial they may be. The Java language is likely to improve and adapt at a faster rate now that the language is becoming open sourced.

If you would like to see some of the benefits of the new Java, go to Danny Coward’s blog and view his entry on the Java SE 6 top ten. He gives several reasons for upgrading to the new Java, including a double digit performance boost, new scripting abilities, and new APIs for developing web services.

http://blogs.sun.com/dannycoward/entry/java_se_6_top_ten

Written by Terry Pearson

December 14th, 2006 at 11:40 pm

Posted in Java,Programming

Free Java Open Source Software Bug Testing.

without comments

Programs inevitably have bugs. No matter how thorough a person is in their coding, there will almost always be some bugs in the code.

Besides running through known possible errors, you can also use software to test your code. A lot of times, the testing software can be expensive. For open source developers, expensive testing software is out of the question.

As announced yesterday, Fortify Software is in the process of opening their Software testing tools to Open Source Developers. They will test the code for free, and give a detailed report on the errors. For non-contributers to a project, they will only see basic information about number or percent of errors.

The tools that will be used include FindBugs and Fortify SCA. These tools are highly acclaimed in software testing.
Some of Fortify’s current customers for professional analysis include Charles Schwab, U.S. Navy, Microsoft, Adobe, CitiGroup, and Digital River.

Written by Terry Pearson

December 13th, 2006 at 5:49 pm

Java to become open source

without comments

Introduction to Java Programming-Comprehensive Version (6th Edition)Sun Microsystems announced on October 25th that they are on the fast track to making Java an open source product.

Sun has been on an open source soapbox since their new CEO, Jonathan Schwartz, took over the company.

Open source software has paved the way for rapid development of great software throughout the world. Projects such as Mozilla’s Firefox, or OpenOffice.org have been shining examples of success in the open source movement.

Making a language opensource is a completely revolutionary idea. It should be interesting to see how Java can maintain stability and long term effectiveness with a less centralized development team.

This could develop into a perfect language, a bloated language, or somewhere in between. My hope is for perfect! We will just have to wait and see what comes of it.

Written by Terry Pearson

November 3rd, 2006 at 8:32 pm

Posted in Business,Java

Improve the web with Nofollow Reciprocity.

Creative Commons License
Terry Pearson - The Blog by Terry Pearson
is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Stop SOPA