The Artima Developer Community
Sponsored Link

Java Answers Forum
java programming problem

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
anthony hutchinson

Posts: 5
Nickname: hutchae1
Registered: Apr, 2003

java programming problem Posted: Apr 11, 2003 8:06 AM
Reply to this message Reply
Advertisement
Enter the following program:

public class Base
{
private static final int ID = 3;
private String name = "Henry";
public void methodA( final int nn ) {
int serialN = 11;
class inner {
void showResult() {
System.out.println( "ID = " + ID );
}
}
new inner().showResult();
}
public static void main (String[] args)
{

}
}


After the program compiles with no errors, print a copy of it, then make the
following changes to it:

1. Modify the main method so that it calls methodA to display the output.
Print the new code.

2. Add another inner class to methodA with a method to display the values
of the name and nn variables. Be sure methodA invokes this new method, then
run the program to display all the output. Print the new code.

3. Create another program that does the same thing as this one, and that
also has separate main, methodA, and showResult methods but that doesn't use
nested classes.


I need some help with this one. can anyone assist??
thanks ahead of time.

anthony

Topic: Confused, small boolean problem Previous Topic   Next Topic Topic: What about Java

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use