The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > General Programming > Java


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Reply
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 07-29-2007, 10:52 AM
nogono nogono is offline
Novice
Join Date: Jul 2007
Posts: 35
iTrader: (0)
nogono is on a distinguished road
Icon13 Java

What exactly do you mean by this syntax?

if(this.running!=running)
{

}

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #2 (permalink)  
Old 07-29-2007, 11:01 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,109
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
Quote:
Originally Posted by nogono View Post
What exactly do you mean by this syntax?

if(this.running!=running)
{

}
That means you have both instance variable of running and local variable of running. this.running refers to the instance of the running variable (outside of your method), while running is refers to the local variable.

For example:
PHP Code:
private int hello 1;
public void test() {
     
int hello 2;
     
System.out.println(this.hello); // printing 1
     
System.out.println(hello); // printing 2

Hope that helps

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #3 (permalink)  
Old 07-29-2007, 11:34 AM
nogono nogono is offline
Novice
Join Date: Jul 2007
Posts: 35
iTrader: (0)
nogono is on a distinguished road
Java

I understand your concept of running...thaks a lot for that..
but i am confused about


if(this.running!=running)
{

}

if this.running is false and running is false
will it enter the loop.....
if yes how?
if not why not?

basically i am trying to get the condition in if loop....

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #4 (permalink)  
Old 07-29-2007, 11:39 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,109
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
no, that means that if this.running is NOT EQUAL to running (assuming that they're not object. Meaning that they're just a primitive type of variables, then you may use that comparison

PHP Code:
public void test() {
     
int one 1;
     
int two 2;
     
int test 1;
     if (
one != two) {
          
System.out.println("test"); 
          
// will be executed since they are NOT equal
     
}
     if (
one == two) {
          
System.out.println("test2");
          
// won't be executed cuz they are NOT equal
     
}
     if (
one == test) {
          
System.out.println("test3");
          
// will be executed because they are equal
     
}

would that helps you

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #5 (permalink)  
Old 07-29-2007, 11:55 AM
nogono nogono is offline
Novice
Join Date: Jul 2007
Posts: 35
iTrader: (0)
nogono is on a distinguished road
Icon13 Look

Thanks a lot for previous help....u are too good to explain anyone...

socket client=null;
serversocket listen_socket;
client=listen_socket.accept();


is it true that only port is getting assigned to socket client.b'coz serversocket only have port....

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #6 (permalink)  
Old 07-29-2007, 12:00 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,109
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
I'm not sure with what you're trying to say, but about networking, here's what happened:

ServerSocket (in the server) will have all of the clients' socket, and each time ServerSocket accept a connection to a client, that client should get a listener (which you will create with multi threading), that way there will be more than one client can connect simultaneously.

port is not assigned to the client, port is opened from the server, and the client will connect to that specific port.

If you're not sure with multi threading, feel free to see my previous tutorial about multi threading, I think I made several of them (they're all in Java forum)

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #7 (permalink)  
Old 07-29-2007, 01:12 PM
nogono nogono is offline
Novice
Join Date: Jul 2007
Posts: 35
iTrader: (0)
nogono is on a distinguished road
Icon4 look

public static final int variable=100;

When we are intializing variable as static...is there any necessity to declare it final......
will be fine if public static int variable=100;

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #8 (permalink)  
Old 07-29-2007, 01:14 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,109
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
Quote:
Originally Posted by nogono View Post
public static final int variable=100;

When we are intializing variable as static...is there any necessity to declare it final......
will be fine if public static int variable=100;
It's depending on your needs, sometimes we want that variable to be final, so that it can't be changed

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

   Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 05:32 PM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50