Question 3

(a) Explain inner class and working of concatenation operator + by giving examples.
//Inner Class Example

class outer
{
int o_x = 52;

void test()
{
Inner inner = new Inner();
inner.show();
}
class Inner
{
void show()
{
System.out.println("Show : X of Outer Class : "+o_x);
}
}
}
class innerClassExampleH2E
{
public static void main(String args[])
{
outer outObj = new outer();
outObj.test();
}
}
//concatenation operator +

public class concatenationOperatorExampleH2E
{
public static void main(String args[])
{
String str1 = "Welcome to : ";
String str2 = "Help2Engg";
System.out.println(str1+str2);
System.out.println("GTU's No.1 Website is : "+str2);
}
}

Make Comments..!!


Palak Shah
wats d output of dis program???
Like · Comment ·
Jaymin Shethwala
Welcome to : Help2Engg GTU's No.1 Website is : Help2Engg
Like ·
Download Android App