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>
Constructor/Default Constructor/Empty Constructor in Java
/* ============================================ File Name : Constructor.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() //Constructor { a = 100; b = 200; } void sum() { int c = a + b; System.out.println("Sum = "+c); } } class Constructor { public static void main(String args[]) { student obj=new student(); obj.sum(); } }
Output of "Constructor.java"
Download Complete Program
-
Read more »
1 comment:
Venkatesh CS
June 13, 2019 at 11:27 PM
Java Constructor method have easy understood me. Thanks.
Java Training in Chennai
Reply
Delete
Replies
Reply
Add comment
Load more...
Java Constructor method have easy understood me. Thanks.
ReplyDeleteJava Training in Chennai