Monday, August 24, 2015

While Loop in Different Forms

Predict the output of the following codes:

1. int i=0;
while(i<10)
{
JOptionPane.showMessageDialog(rootPane,"hello");

}


2.   int i=110;
while(i<10)
{
JOptionPane.showMessageDialog(rootPane,"hello");
}


3.  int i=0;
while(i<10);
{
JOptionPane.showMessageDialog(rootPane,"hello");
i=i+1;
}


4.   int i=0;
while(i<10)
{
JOptionPane.showMessageDialog(rootPane,"hello");
i++;
}


5.  int i=0;
while(i<10)
{
JOptionPane.showMessageDialog(rootPane,"hello");
i--;
}


6.  int i=0;
while(i==10)
{
JOptionPane.showMessageDialog(rootPane,"hello");
}


7.  while(i<10)
{
JOptionPane.showMessageDialog(rootPane,"hello");
}


8.  int i=0;
while(i<10)
{
JOptionPane.showMessage Dialog(rootPane. "hello");
}


9. int i=0;
while(i<10)
{
JOptionPane.showMessageDialog(rootPane,"hello");
i=10;
}


10. int i=0;
while(i<10)
{
JOptionPane.showMessageDialog(rootPane,"hello");
i=i+1;
i=i-1;
}

11.

while(1)
{
JOptionPane.showMessageDialog(rootPane,"hello");
}


Wednesday, August 19, 2015

Sample HTML Code

In this HTML code we are learning how to write the tags like

  1. H1 to H6 (Heading) 
  2. HR (Horizontal Tag)
  3. B (Bold tag)
  4. U (Underline Tag>
  5. I (Italic tag)
  6. Font (font tag)
  7. Font tag Attributes like FACE, SIZE, COLOR
  8. CENTER (Center tag)
  9. BR (Line Break)

Sample Code of HTML tags

<html>
<head><title>Lets Learn HTML</title></head>
<body bgcolor="ff6633" text=white>
<center>
<h1>Heading</h1>
<hr>
Horizontal Rule<br>
<hr>
<br>This is sample <b>BOLD</b> <br>
<br>This is sample <u>UNDERLINE</u><br>
<br>This is sample <i>ITALIC</i><br>
<br>This is sample <font face="Lucida Handwriting" size=10>FONT FACE</font><br>
<br>This is sample <font size=10>FONT SIZE</font><br>
<br>This is sample <font color=red size=10>FONT COLOR</font><br>
<br>This is sample SUB SCRIPT:<font size=10> Log<sub>e</sub></font><br>
<br>This is sample SUPER SCRIPT:<font size=10>X<sup>2</sup></font> <br>
<br>This is sample <br>
<br>This is sample<br>
</center>
</body>
</html>

OUTPUT:



Tuesday, August 18, 2015

How to write an if construct in java

User Interface:

Code written on the event of Check age Button:

int age;

age=Integer.parseInt(jTextField1.getText());

if(age<=0)
{
    jLabel2.setText("ERROR");
}
else
{
    if(age>0 && age<=50 )
    {
        jLabel2.setText("Young Age");
    }
    else
    {
        jLabel2.setText("Old Age");
    }
}