Article does not exist.
Computer programming

Computer programming

Computer programming news and links

Articles

Java Tutorial The final Keyword

Java Tutorial The final Keyword The final keyword can be applied to variables, methods and classes. To remember the function of the keyword, just remember that it simply restricts what we can do with the variables, methods and classes. The value of a final variable can no longer be modified once its value has been set. For example, final int data = 10; The following statement will cause a compilation error to occur: data++; A final method cannot be overridden in the child class. final void... Read Full Story

Hide PopupControlExtender On Click

From:  sitepoint.com
I have a user control which is comprised of a textbox, a treeview, and a popupcontrolextender which shows the treeview when the textbox is clicked. Whenever the user selects a node in the treeview, the node's information is then shown in the textbox and the popup disappears. Everything works great until AJAX enters the picture. On one of my pages I add this user control to an UpdatePanel which has a few other controls. When I do this everything still works except for one small detail... Read Full Story

Java Tutorial: Interface

Java Tutorial: Interface Declaring an interface is basically declaring a class but instead of using the class keyword, the interface keyword is used. Members are public when the interface is declared public. Java Tutorial: Interface Coding Guidelines: Attributes are implicitly static and final and must be initialized with a constant value. Like in declaring a top-level class, the only valid access modifiers are public and package (i.e., if no access modifier prefixes the class keyword). A... Read Full Story

Java Tutorial: The this Keyword

Java Tutorial: The this Keyword The this keyword can be used for the following reasons: Disambiguate local attribute from a local variable Refer to the object that invoked the non-static method Refer to other constructors As an example for the first purpose, consider the following code wherein the variable data serves as an attribute and a local parameter at the same time. class ThisDemo1 { int data; void method(int data) { this.data = data; /* this.data refers to the attribute while data... Read Full Story

Java Inheritance

Java Inheritance In Java, all classes, including the classes that make up the Java API, are subclassed from the Object superclass. A sample class hierarchy is shown below. Any class above a specific class in the class hierarchy is known as a superclass. While any class below a specific class in the class hierarchy is known as a subclass of that class. Inheritance is a major advantage in object-oriented programming since once a behavior (method) is defined in a superclass, that behavior is... Read Full Story

Java Tutorial: Instantiating a Class

Java Tutorial: Instantiating a Class To instantiate a class, we simply use the new keyword followed by a call to a constructor. Let's go directly to an example. class ConstructObj { int data; ConstructObj() { /* initialize data */ } public static void main(String args[]) { ConstructObj obj = new ConstructObj(); //instantiation } } Java Tutorial: Accessing Object Members To access members of an object, we use the "dot" notation. It is used as follows: object.member The next example is based on... Read Full Story

Java Tutorial Polymorphism

Java Tutorial Polymorphism Now, given the parent class Person and the subclass Student of our previous example, we add another subclass of Person which is Employee. Below is the class hierarchy for that, In Java, we can create a reference that is of type superclass to an object of its subclass. For example, public static main( String[] args ) { Person ref; Student studentObject = new Student(); Employee employeeObject = new Employee(); ref = studentObject; //Person ref points to a // Student... Read Full Story

Java Tutorial Overloading Methods

Java Tutorial Overloading Methods In our classes, we want to sometimes create methods that has the same names but function differently depending on the parameters that are passed to them. This capability is possible in Java, and it is called Method Overloading. Method overloading allows a method with the same name but different parameters, to have different implementations and return values of different types. Rather than invent new names all the time, method overloading can be used when the... Read Full Story

Java tutorial Sample Source Code for StudentRecord class

Java tutorial Sample Source Code for StudentRecord class Here is the code for our StudentRecord class, public class StudentRecord { private String name; private String address; private int age; private double mathGrade; private double englishGrade; private double scienceGrade; private double average; private static int studentCount; /** * Returns the name of the student */ public String getName(){ return name; } /** * Changes the name of the student */ public void setName( String temp ){ name... Read Full Story

Java Program Structure

Java Program Structure This section summarizes the basic syntax used in creating Java applications. Declaring Java Classes Remember that for a top-level class, the only valid access modifiers are public and package (i.e., if no access modifier prefixes the class keyword). The following example declares a SuperHero blueprint. class SuperHero { String superPowers[]; void setSuperPowers(String superPowers[]) { this.superPowers = superPowers; } void printSuperPowers() { for (int i = 0; i... Read Full Story
Top Geek Articles
Celebrities on the Phone
Cell phones are to celebrities like bats are to baseball: no one runs too far without them.
Hot Geeks -- The Sexiest Geeky Girls
These girls are gorgeous AND they'll play Warcraft with you. Doesn't get much better than that.
Hottest Girl Superhero List
A list of female video-game characters you should check out.
More From Zimbio
Copyright © 2009 - Zimbio, Inc. Some rights reserved.