July 29, 2003

Make Your Program Both an Applet and an Application

Sometimes it’s convenient to have your program be runnable both as an applet and as an application. One simple way of accomplishing this derives from the fact that any class can have a main method. If you’ve written your program as an applet, just add a main method, in which

Get the Current Directory

The program is used to display the current and parent directory. ‘.’represents the current directory and ‘..’ represents the parent directory import java.io.File; public class CurrentDir { public static void main (String args[]) { File dir1 = new File (.); File dir2 = new File (..); try { System.out.println (Current

Breaking Data Hiding

It is said that C++ provides data hiding, but the following code shows that this is not always true. You can break the C++s data-hiding facility using the memory function: class Myth { int x;}; // here x is a private variable.int main(){Myth obj;int val;// set the value of the

Get the Maximum Value Across Columns in TSQL

There is no TSQL function for extracting maximum values across columns. However, you can use MAX() and MIN() functions to obtain the maximum or minimum value in any particular row. The following example shows how to get max value across columns in a table: –////////////////////////////////////////////////CREATE TABLE #tblScores (StudentID INT PRIMARY