Difference between Applets and Applications Program in Java with Examples

Introduction to Applets and Applications in Java

Venn diagram explaining features of Java Applets and Application

Venn diagram explaining features of Java Applets and Application

In java an applet is a special kind of Java program that a browser enabled with Java technology can download from the internet and run. An applet is typically embedded inside a Web page and runs in the context of the browser. In order to be provided with the standard interface between the applet and the browser environment, an applet must be a subclass of the java.applet.Applet class or javax.swing.JApplet class. Java applets are compiled using javac command, but are run either with a browser or with the appletviewer command.

Applications in java are thought to be larger than applets which runs in a desktop mode and is used as productive software application. They can be created by writing packages other than java.applet.Applet. Java application programs run in a standalone environment with the support of virtual machine(JVM). Java applications are also compiled using the javac command and run using java command. A java application has a full network and local file system access, and its potential is limited only by the creativity of its developers. (more…)

Object Oriented Programming – Theory and Examples

What is Object Oriented Programming?

Object Oriented Programming (OOP) is commonly used in programs which require doing the same things over and over again. Much like a function or method can be ran multiple times, OOP classes can be ran multiple times, simultaneously.

When is OOP used?

OOP is used in games and some other software. The reason it is used in games is because the game requires the same things to happen over and over again at the same time, for example… (more…)

Java DataBase Connectivity API – (JDBC API)

JDBC is a Java Database Connectivity API that lets you access virtually any tabular data source from a Java application.

In addition to providing connectivity to a wide range of SQL databases, JDBC allows you to access other tabular data sources such as spreadsheets or flat files.

Although JDBC is often thought of as an acronym for Java Database Connectivity, the trademarked API name is actually JDBC.

JDBC defines a low-level API designed to support basic SQL functionality independently of any specific SQL implementation. This means the focus is on executing raw SQL statements and retrieving their results. (more…)

Best C/C++ Compilers and IDEs for Programmers

If you’re interested in learning to program in C/C++ you’ll find this list of C/C++ Compilers handy. You’ll need one for The C/C++ Programming tutorials we have on site. Most of these compilers do C++ and C. Just rename the files to have .C for C Programs and .cpp for C++ programs extensions. Here I have made a list of some best and free C/C++ compilers and IDEs for Computer Programmers.

(more…)

List of development tools for Linux platform – IDEs & Compilers

One of my most recent endeavors was to set up my old linux machine for development. I chose the Debian Squeeze(6.1.5) distro because of its reputation for stability and also its minimalist approach towards installing packages, and both these features were quite welcome. Having said that, the tools listed here can be downloaded and installed on any distro, in case they are not already included in the installation CD/DVD. Based on my development experience with these tools, this list is frequently updated with new information: (more…)

C++ Program to find Age and Days With Date of Birth Given using Class

Concept:
In this C++ Program the problem is to find age and days of birth when Date of Birth and present date is given. So main concept behind it is to find the difference between two given dates, using class structure in C++ Programming Language.
To Find Age in format Year/Month/Day

Year(Final) = Date(PresentYear) – BirthYear.
Month(Final) = Date(PresentMonth) – BirthMonth.
Day(Final) = Date(PresentDay) – BirthDay.

Again another function is to find the total days after birth.
To Find total days after birth

totalDays = (finalYear*365 + finalMonth*30 + finalDay);
/*
* Program to calculate age and days
* Given 
* --- Current date
* --- Your Date of Birth
* Results
* --- Finds out your age in format of Year/Month/Day
* --- Finds out Total Days 
* Note: I have not calculated the days with refrence to Leap Year that occurs in 4 Years gap.
* Author: Luzan Baral
* Twitter: http://twitter.com/luzanb
*/
 
#include<iostream>
#include<cstdlib>
#include<conio.h>
using namespace std;
 
class Find_DOB{
	public:
		int finalYear; // The Year 
		int birthYear; // The Year (Maths) 
		int presentYear; // The Year (Current) 
		int finalMonth; // The Month 
		int birthMonth; // The Month (Maths) 
		int presentMonth; // The Month (Current) 
		int finalDay; // The Day 
		int birthDay; // The Day (Maths) 
		int presentDay; // The Day (Current) 
		long int totalDays; //Stores total days
		//default constructur
		Find_DOB(){
			finalYear=0;
			birthYear=0;
			presentYear=0;
			finalMonth=0;
			birthMonth=0;
			presentMonth=0;
			finalDay=0;
			birthDay=0;
			presentDay=0;
			totalDays=0;
		}
		//fuction to get today's date
		void get_todayDate(){
			cout < < "Please enter the current date. (In Numeral)" << endl; 
			cout << "" << endl; 
			cout << "" << endl; 
			cout << "Enter the current year: ";  			cin >> presentYear; // Enter current year of date and hold in YYY. 
			cout < < "Enter the current month: ";  			cin >> presentMonth; // Enter current month of date and hold in MMM. 
			cout < < "Enter the current day: ";  			cin >> presentDay; // Enter current day of date and hold in DDD. 
			cout < < "" << endl; 
			cout << "" << endl; 
		}
		void get_DOB(){
			// The DOB. 
			cout << "Please enter your DOB." << endl; 
			cout << "Year: "; 
                        cin >> birthYear; // Enter year of birth and hold in YY. 
			cout < < "Month: ";  			
                        cin >> birthMonth; // Enter month of birth and hold in MM. 
			cout < < "Day: ";
  			cin >> birthDay; // Enter day of birth and hold in DD. 			
		}
		void calc_days(){
			finalYear = abs(presentYear - birthYear); // Year(Final) = Date(PresentYear) - BirthYear. 
			finalMonth = abs(presentMonth - birthMonth); // Month(Final) = Date(PresentMonth) - Birth(Month). 
			finalDay = abs(presentDay - birthDay); // Day(Final) = Date(PresentDay) - BirthDay. 
			cout < < "" << endl; 
			cout << "You are " << finalYear << "/" << finalMonth << "/" << finalDay << " years old." << endl; // Result. 
			totalDays = (finalYear*365 + finalMonth*30 + finalDay);
			cout << "Total of "<< totalDays <<" Days."<<endl; 
		}		
};
 
int main() 
{ 
	Find_DOB obj;
	// The Date. 
	cout << "This is a progran to tell how old you are..." << endl; 
 
	obj.get_todayDate();
	obj.get_DOB();
	obj.calc_days();
 
	getch();
	return 0; 
}