Username   Password       Register
Programming

How to Declare a Constant in Java

Java does not directly support constants. However, a static final variable is effectively a constant.

The static modifier causes the variable to be available without loading an instance of the class where it is defined.

The final modifier causes the variable to be unchangeable.Naming standards for Java constants

Java constants are normally declared in ALL CAPS.

Words in Java constants are normally separated by underscores.Sample Java constant Declaration

public class MAX_UNITS {...

Read more...
 

javascript:void(0)

javascript:void(0) is used with the Href attribute of the <a> tag. Usually, clicking on a typical hyperlink reloads a web page or redirects to another web page. This may not be feasible every time. Many a times, clicking on a hyperlink may require performing some client side script operation instead of reloading or redirecting. This can be achieved placing “javascript:void(0)” in the Href attribute of the <a> tag.

Example
<a...

Read more...
 

Java Method

A Java method is a set of Java statements which can be included inside a Java class.

Java methods are similar to functions or procedures in other programming languages.

Every Java program must have one main() method.

Here is the main() method from a Java program which prints "Hello World":

public static void main (String[] args) {
// This Java program prints "Hello World!"
System.out.println{"Hello World!");
}
 

How to Check my Java Version

Check the Java version from the Command Line

To check the version of JRE that you are running, use the `java -version` command.

C:\>java -version
java version "1.4.2_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)

Check the Java version of your Web Browser

To check the Java version in your web browser, use the script at JavaTester.

 

Java Data Types

Java has two groups of data types, primitive data types and object references.Java Primitive Data TypesData TypePurposeContentsDefault Value*booleanTruth valuetrue or falsefalescharCharacterUnicode characters\u0000byteSigned integer8 bit two's complement(byte) 0shortSigned integer16 bit two's complement(short) 0intSigned integer32 bit two's complement0longSigned integer64 bit two's complement0LfloatReal number32 bit IEEE 754 floating point0.0fdoubleReal number64 bit IEEE 754 floating...

Read more...
 

Java Class

A Java class is a group of Java methods and variables.

Each Java source code file can contain one public class. The name of this public class must match the name of the Java source code file. If the public class is called "ballistics", then the filename would be "ballistics.java".

A sample Java class

class Ammunition {
int diameter;
int length;
String name;
}
 

How to Enable JavaScript

How to enable JavaScript in Internet Explorer

To enable JavaScript in Internet Explorer

  1. Select the Tools menu
  2. Select the Internet Options menu item
  3. Select the Security tab
  4. Click the Custom Level button
  5. Scroll down to Scripting of Java applets
  6. Check the Enable radio button
  7. Click the OK button
  8. Click the OK button

How do I enable JavaScript in Internet Explorer?

To enable JavaScript in Firefox

  1. Select Tools from menu
  2. Click on Options
  3. Select Content tabs from above tab list
  4. Chek the Enable JavaScript checkbox
Enable javascript in firefox
 

Uninstall Java

Uninstall Microsoft JavaClick the Start button Click the Run button Enter RunDll32 advpack.dll,LaunchINFSection java.inf,UnInstall and press the <RETURN> Click Yes Let the process reboot your machine Click the Start button Click the Run button Enter cmd and press <RETURN> to open a command shell Enter the command rd /s %System_Root%\java Enter the command del %System_Root%\inf\java.pnf Enter the command del %System_Root%\SYSTEM32\jview.exe Enter the command del...

Read more...
 

SQL Injection Attack / Vulnerability

A SQL injection vulnerability can occur when a poorly-written program uses user-provided data in a database query without first validating the input. This is most-often found within webpages with dynamic content. There are some excellent tutorials and descriptive articles on this subject, as well as many vulnerability postings for different applications from full-disclosure websites.

A simple example of SQL injection is a basic HTML form login in which you provide a username and password:...

Read more...
 

Integer Overflow

An integer overflow, or integer wrapping, is a potential problem in a program based upon the fact that the value that can be held in a numeric datatype is limited by the data type's size in bytes. ANSI C uses the following minimum sizes: data type size (bytes) char 1 short 2 int 2 long 4

In practice, many compilers use a 4-byte int. It also should be noted that the actual ranges for the data types depend...

Read more...
 
«StartPrev123456789NextEnd»

Page 1 of 9