Home
Tutorials
Core Java
Introduction To Java
Java Evolution
Overview of Java
Constants, Variables and Data Types
Java Operators
Branching Statements
Looping Statements
Classes, Objects and Methods
Inheritance
Array, String and Vectors
Java Interfaces
Java Packages
Applet Programming
Graphics Programming
Advanced Java
Java AWT
Java Event Handling
Java File Handling
Java MultiThreading
Java Swing-I
Java Swing-II
Exception Handling
Socket Programming
Java Database
Java RMI
Java Servlets
Java Beans
Programms
Projects
Downloads
Contact
Java Programming
!doctype>
Parameterized Constructor in Java
/* ============================================ File Name : ParamConstructor.java WebSite : http://javaproglang.blogspot.in/ Created By : Bintu Chaudhary Email ID : bintu.chaudhary.mks@gmail.com ============================================ */ import java.io.*; class student { int a,b; student(int x, int y) //Parameterized Constructor { a = x; b = y; } int sum() { return(a+b); } } class ParamConstructor { public static void main(String args[]) { student obj=new student(40,80); int sum= obj.sum(); System.out.println("Sum="+sum); } }
Out of "ParamConstructor.java"
Download Complete Program
-
Read more »
No comments:
Post a Comment
No comments:
Post a Comment