<< < 166 167 168 169 170 171 172 173 174 > >>   Sort: Rank

Swing BorderLayout and Contrainer Classes
Name the containers which uses Border Layout as their default layout? Swing container classes which uses BorderLayout as their default are: Window, Frame and Dialog classes.
2007-03-03, 5347👍, 0💬

Differences between Interfaces and Abstract Classes
What's the difference between an interface and an abstract class? An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implemen...
2007-03-03, 5491👍, 0💬

System.setOut() - Setting Standard Console Output to
How could Java classes direct program messages to the system console, but error messages, say to a file? The class System has a variable out that represents the standard output, and the variable err that represents the standard error device. By default, they both connected to the system console. But...
2007-03-03, 8101👍, 0💬

System.loadLibrary() - Loading DLL for JNI Interface
An application needs to load a library before it starts to run, how to code? One option is to use a static block to load a library before anything is called. For example, class Test { static { System.loadLibrary("myApp.dll" );} .... } When you call new Test(), the static block will be called first b...
2007-03-03, 8003👍, 0💬

Troubleshooting NullPointerException
What is NullPointerException and how to handle it? When an object is not initialized, the default value is null. When the following things happen, the NullPointerException is thrown: Calling the instance method of a null object. Accessing or modifying the field of a null object. Taking the length of...
2007-03-03, 8007👍, 0💬

Runable Interface and Thread
What is more advisable to create a thread, by implementing a Runnable interface or by extending Thread class? Strategically speaking, threads created by implementing Runnable interface are more advisable. If you create a thread by extending a thread class, you cannot extend any other class. If you c...
2007-03-03, 6484👍, 0💬

Clone of Map Objects
Jack developed a program by using a Map container to hold key/value pairs. He wanted to make a change to the map. He decided to make a clone of the map in order to save the original data on side. What do you think of it? If Jack made a clone of the map, any changes to the clone or the original map w...
2007-03-03, 6919👍, 0💬

Virtual Functions in Java
Can you have virtual functions in Java? Yes, all functions in Java are virtual by default. This is actually a pseudo trick question because the word "virtual" is not part of the naming convention in Java (as it is in C++, C-sharp and VB.NET), so this would be a foreign concept for someone who has on...
2007-03-03, 6298👍, 0💬

Well-Written Object Oriented Programs
What does a well-written Object Oriented program look like? A well-written object oriented program exhibits recurring structures that promote abstraction, flexibility, modularity and elegance.
2007-03-03, 6817👍, 0💬

What is Java
What is Java? Java is an object-oriented programming language developed initially by James Gosling and colleagues at Sun Microsystems. The language, initially called Oak (named after the oak trees outside Gosling's office), was intended to replace C++, although the feature set better resembles that ...
2007-03-03, 5797👍, 0💬

Variables in Double Quoted Strings
Would I use print "$a dollars" or "{$a} dollars" to print out the amount of dollars in this example? In this example, "$a dollars" or "{$a} dollars" will print the same result. But in other cases, you need to use curly braces to protect variable names. For example, for following PHP script will prin...
2007-02-27, 6461👍, 0💬

Octal and Decimal Numbers
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what's the problem? If you assign a variable with a value of 0123, PHP will interpret as an octal number resulting to decimal value of 83. All numbers that preceded with a 0 (zero) will be interpreted...
2007-02-27, 8737👍, 0💬

Executing a PHP Script Using Command Line
How can I execute a PHP script using command line? Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. For example, "php myScript.php", assuming "php" is the command to invoke the CLI program. Be aware that if your PHP script was w...
2007-02-27, 6365👍, 0💬

mysql_fetch_object() and mysql_fetch_array() Functions
What is the difference between mysql_fetch_object() and mysql_fetch_array() functions in PHP? mysql_fetch_object() fetches the current row of data from the query result associated with the specified result identifier. The row is returned as an object. See the example code: &lt;?php $result = mys...
2007-02-27, 6926👍, 0💬

urlencode() and urldecode() Functions?
What are urlencode() and urldecode() functions in PHP? string urlencode(str) - Returns the URL encoded version of the input string. String values to be used in URL query string need to be URL encoded. In the URL encoded version: Alphanumeric characters are maintained as is. Space characters are conv...
2007-02-27, 6526👍, 0💬

require(), include() and include_once() Functions
What are the differences between require(), include() and include_once() functions in PHP? All three functions are used to include and evaluate a file into the current script execution. The include_once() statement includes and evaluates the specified file during the execution of the script. This is...
2007-02-27, 5584👍, 0💬

Uploading Files with File Input Fields in a Form
How To Write the FORM Tag Correctly for Uploading Files? When users clicks the submit button, files specified in the &lt;INPUT TYPE=FILE...> will be transferred from the browser to the Web server. This transferring (uploading) process is controlled by a properly written &lt;FORM...> tag as: ...
2007-02-27, 5430👍, 0💬

Uploading Files with File Input Fields in a Form
How To Write the FORM Tag Correctly for Uploading Files? When users clicks the submit button, files specified in the &lt;INPUT TYPE=FILE...> will be transferred from the browser to the Web server. This transferring (uploading) process is controlled by a properly written &lt;FORM...> tag as: ...
2007-02-27, 5311👍, 0💬

define() - Defining Constants
How do you define a constant in PHP? You can define a constant by using the define() function. Once a constant is defined, it can never be changed or undefined. For example: &lt;?php define("CONSTANT", "Hello world."); echo CONSTANT; // outputs "Hello world." echo Constant; // outputs "Constant"...
2007-02-27, 5588👍, 0💬

Persistent Cookies
What Is a Persistent Cookie? A persistent cookie is a cookie which is stored in a cookie file permanently on the browser's computer. By default, cookies are created as temporary cookies which stored only in the browser's memory. When the browser is closed, temporary cookies will be erased. You shoul...
2007-02-27, 5821👍, 0💬

Differences between Simple Variables and Variable Variables
What is the difference between $message and $$message in PHP? $message is a simple variable with a fixed name which is called "message". $$message is a variable variable with a variable name which is stored in another variable called $message. If $message contains "user", $$message is the same as $u...
2007-02-27, 5405👍, 0💬

Number of Days between Two Dates
How can we know the number of days between two given dates in PHP? Simple arithmetic: &lt;?php $date1 = date('Y-m-d'); $date2 = '2006-07-01'; $days = (strtotime($date1) - strtotime($date2)) / (60 * 60 * 24); $days = (int) $days; echo "Number of days since '2006-07-01': $days"; ?&gt;
2007-02-27, 6424👍, 0💬

What Is PEAR
What Is PEAR? PEAR is the next revolution in PHP. This repository is bringing higher level programming to PHP. PEAR is a framework and distribution system for reusable PHP components. It eases installation by bringing an automated wizard, and packing the strength and experience of PHP users into a n...
2007-02-27, 5465👍, 0💬

What Is a Session
What Is a Session? A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests. There is only one session object available to your PHP scripts at any time. Data saved to the session by a script can be retrieved by the same script or another s...
2007-02-27, 5601👍, 0💬

<< < 166 167 168 169 170 171 172 173 174 > >>   Sort: Rank