Jump to content


Check out our Community Blogs

icepack

Member Since 17 Jul 2006
Offline Last Active Oct 04 2008 08:57 PM
-----

#343786 NullPointerException... Help please.

Posted by icepack on 20 January 2008 - 01:53 PM

I'm not familiar with this, but

public void setLayout(LayoutManager mgr)

and you are passing it null, which it might not like?
  • 1


#316886 Loops

Posted by icepack on 26 July 2006 - 02:44 PM

It's important to know about the different kinds of loops and when to use each one. For instance, if you know you have to run something a certain amount of times(lets say 10 times), you'd use a for loop
for(int i=1; i <= 10; i++){
this action will be done 10 times, no more or no less(unless somehwere in the code the variable i is overridden and set to 10);
}

or let's say you are taking input from a user and they are to enter 0 when they are done(these loops can be evaluated by T/F). the do-while loop
do{
cin >> length;
[I]code actions[/I]
} while(length != 0);

the while loop is similar to the do-while loop, except for the fact taht regardless of what happens, the do-while loops body will be executed at least once.
  • 1


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download