Вы находитесь на странице: 1из 4

7-08-2013

PROGRAM NO 1
AIM: Write a program to print HELLO WORLD on screen
!O"R#E #ODE:
class gautam
{
public static void main(String args[])
{
System.out.println("HELLO O!L"")#
$
$
7-08-2013
PROGRAM NO $%
AIM: Write a program in &'ic' t&o c(asses are ma)e an) a *+nction o* one c(ass is
accesse) ,- t'e o,.ect o* t'e *irst c(ass )ec(are) in t'e ot'er c(ass
!O"R#E #ODE:
class %
{
%()
{
System.out.println("&Onstructor o' class y")#
$
public void s(o)()
{
System.out.println("*(is is a 'unction o' class %")#
$
$
class y
{
public static void main(String args[])
{ % ob+,ne) %()#
ob+.s(o)()#
$
$
PROGRAM NO $/
7-08-2013
AIM: Write a program to c'ec0 &'et'er a string is a pa(in)rome or not
!O"R#E #ODE:
class palindrome
{
void c(ec-palindrome(String a)
{
String reverse, ne) String("")#
int lengt(, a.lengt(()#
'or(int i,lengt(./#i0,1#i..)
{
reverse , reverse 2 a.c(ar3t(i)#
$
i'(a.e4uals(reverse))
{
System.out.println("String is a palindrome")#
$
else
{
System.out.println("5t is not a palindrome")#
$
$
$
class gtpl
{
public static void main(String args[])
{
String original,ne) String("madam")#
palindrome ob+,ne) palindrome()#
ob+.c(ec-palindrome(original)#
$
$
7-08-2013

Вам также может понравиться