Sunday, November 13, 2011
Sunday, November 6, 2011
java program to add 2 numbers
//add this program to your package
class addnum
{
public static void main(String [] args)
{
int number1=Integer.parseInt(args[0]);
int number2=Integer.parseInt(args[0]);
System.out.println(number1+number2);
}
}
/* run the program and enter 2 integer values like,
4 5
output:
9
*/
java program to add 2 strings
//include this program in your package
class calc
{
public static void main(String args[])
{
System.out.println(args[0]+args[1]);
}
}
/*run the program and enter 2 strings
like,abc def
output:abcdef
*/
Saturday, October 29, 2011
virtual function
In Java a function can be made virtual by just attaching the keyword virtual to implement polymorphism.Eg:-
class any
{
int a;
float b;
virtual void show()
{
System.out.println("a="+a+"\n b="+b);
}
}
class many extends any
{
int a1;
float b1;
void show()
{
Syatem.out.println("a="+a+"\n b="+b);
}
public static void main()
{
any *ptr;
many *ptr1;
ptr=&ptr1;
ptr->show();
ptr->show();
}
}
Monday, October 24, 2011
link list creation
A link list is a way to represent data so that each element points to next element.
steps to create a link list.
1.create a structure :
struct linkl
{
char name[20];
int number;
linkl *next;
};
two data members name and number are created and a self referential pointer next is created.
Subscribe to:
Posts (Atom)
-
Hi Guys , In this blog I will share information related to error : can't bind to 'formcontrol' since it isn't a known pr...
-
Hi Guys , This blog is about the error " Target container is not a DOM element. " The full error in the console log is ...
-
Error Blog This blog is about the error Error: Objects are not valid as a React child Problem Statement error on start of...