Strange question,Help me, always got the same value

Hi,
I write a program, have following code:
public class T{
private int iNum=0;
public T(){};
public void do_a(){
iNum++;
System.out.println("---Num="+iNum);
public void do_b(){
System.out.println("---Show Num="+iNum);
public static void main(String []args){
T t=new T();
do_a(); //ok, result is right, ---Num=1
do_b(); //ok, result is right, ---Num=1
when i use this class with other class, function do_a() is correct,
but do_b() always show "---Show Num=0",
why, i can't think it out, so strange,
any advice is kind of you!

Your problem is that you are not using the object you have created. The statement:
T t = new T();Creates a new instance object of the type T. Having created this object I assume that you want to call the methods attached to this object. To do that you have to add at the beginning of any method call the name of the object and a dot eg.
do_a();//This accesses the method from a static context
t.do_a();//This will access the method and increment the variables contained within the instance tHowever even if you are accessing this object from a static context then the value iNum is still incremented. But you will need to add the keyword static to the method declarations of do_a() and do_b() so that they can be run from main().

Similar Messages

  • GUID generation issue, SYSUUID always returns the same value.

    Hi,
    I'm using "SELECT SYSUUID FROM DUMMY" to get a guid value but it always return the same value.
    What should I do to get a unique value each time I execute the query above.
    Thanks.

    I thought I had the same problem and I found that if you generate multiple UUID's in the same SQL, it they will be the same.  If you make multiple calls, you should get multiple UUID's. 
    Try this:
    SELECT SYSUUID as UUID1 FROM DUMMY;
    SELECT SYSUUID as UUID2 FROM DUMMY;
    I get the following results:
    UUID1 = 538632FD7EA20426E10000000A3F10A9
    UUID2 = 538632FE7EA20426E10000000A3F10A9
    Notice that the strings look almost identical, but the 8th character on UUID1 is a D and the 8th on UUID2 is a E.
    Jim

  • Hello,  I have a strange file in my Users folder, named PortDetect.log I have no idea which app created it and it reappears when I delete it.  Has anyone got the same file? Or know where it may originate from?  Thanks in advance!

    Hello,
    I have a strange file in my Users folder, named PortDetect.log
    I have no idea which app created it and it reappears when I delete it.
    Has anyone got the same file? Or know where it may originate from?
    Thanks in advance!

    know where it may originate from?
    The Huawei wireless modem driver.

  • I purchased Acrobat Standard, not realizing it is not compatible with MAC. I need to exchange. I just chatted with a so-called "specialist" who told me to sign in and download the same program. I got the same blasted message. I need help. I need to exchan

    I purchased Acrobat Standard, not realizing it is not compatible with MAC. I need to exchange. I just chatted with a so-called "specialist" who told me to sign in and download the same program. I got the same blasted message. I need help. I need to exchange this program for one that is compatible with my MAC. The standard is of no use to me at all. I feel like I have been ripped off

    Hi Kargi,
    We are working on getting things straightened out for you. You should be hearing from a Customer Care agent shortly.
    Best,
    Sara

  • When i download the latest version of itunes the download percent freezes, and not always at the same percentage. I have windows 7, please help!

    When downloading the latest version of itunes the download freezes everytime but not always at the same percent. I have tried selecting the download only option and still didnt work. Please help!

    Do you have Windows XP Pro?
    see https://discussions.apple.com/thread/5840089?tstart=0
    there is a stupid checkbox you must uncheck, saying "protect my computer and data from unauthorized program activity"
    You see this screen when you right-click on the ItunesSetup.exe in your Downloads folder.
    downloads>ItunesSetup.exe  (right-click)>yourself as admin & UNCHECK THAT BOX!>  conntinue with new installation and even find your old playlists still  intact!!
    This is apparently a Windows XP fix alone. MSVCR80.dll is (probably) reinstalled by Itunes under a partnership aggreement with Microsoft.
    Using the Microsoft "Fix It" utility at http://support.microsoft.com/mats/program_install_and_uninstall/en does NOT fix anything. Abandon All Hope Ye Who Run This Utility More Than Once

  • Problem: ipod server could not be contacted, i went to control panel, lan settings, ck'd auto detect and went back to i-tune to update and got the same error message, any help is appreciated

    Error message: Ipod software update server could not be contacted. I went to control panel, lan settings, clk'd auto detect settings and ok. When i went back to i tunes and clk's update, i got the same error. Any help is appreciated.
    Rand221

    See the previous posts on the right side of this page under the heading "More Like This" that have you same error message.

  • HT5192 I cant update my mibile always i got the same message. An error occurrd during updating and sime times cannot establish connection ?!!!!

    I cant update my mibile always i got the same message. An error occurrd during updating and sime times cannot establish connection ?!!!!

    Hi Martha Leal Tapia,
    Yes this issue was resolved. I had to add the below two parameters in the instance profile and continue the installation.
    icm/server_port_1 = PROT = P4, PORT = 5$(SAPSYSTEM)04, HOST = <full hostname as in the /etc/hosts file>
    icm/host_name_full=<full hostname as in the /etc/hosts file>
    Note 1158626 P4 connection to ICM on machine with multiple IPs fails.
    You can refer following SAPnote # 609603 for the above concepts although this refers to old release."
    Thanks and regards
    Ananth

  • I keep getting notified that there is an update to Firefox Weather 2.0.1 but when I try to install it I always get the same "download error" -228. How do I get around this?

    I don't think additional details will help since I don't have any. I have tried repeatedly to install this update and always get the same result which I have already detailed. This is technically an Add-On but I was given no place to ask questions about it.

    See if this helps you. <br />
    https://support.mozilla.com/en-US/kb/unable+to+install+add-ons#Download_Error_228

  • Make a file extension to open always with the same app

    Hello, do you know how can I make a file extension to open always with the same app. So far I have been doing it by double click > open with > other > and then mark open always with this app, BUT
    I do not want to do this very time with all the same file extension I have in my hard disk, is there any way, like in windows, to select and preset a determined app to always open all files with the same extensión in my hard disk??
    Actually what I´m experiencing and would like to change is to open always .pdf extensión with Acrobat and not with Preview
    Thanks very much in advance for your help!!

    OK!!!!
    Got it!!!
    Thanks anyway!!

  • Playlist shuffle always plays the same few songs

    I got a playlist that has roughly 250 songs. Everytime I connect my Ipod to charge it, then disconnect and start the playlist on shuffle mode, there's always a 20 to 30 songs playing first. If I close my Ipod and start the playlist again (still on it most of the time), it shows 1 of 250 and plays the same songs, but not in the same exact order (though sometimes it does for 2 or 3 songs). Just like if the shuffle was on "low" mode or something. It's still choose randomly some song here and there, but not that much since it the same few, ALL THE TIME for a while. The only way to get around this is to connect my Ipod to my computer again (it reset it somehow) or leave it open all the time so it knows wich song has been played (but that's terribly stupid). Is there any other way to go around that shuffling loop? I found myself skipping most of the time since I always hear the same few songs even though there's some songs in the playlist I've never ever played on the Ipod. Is there a way to set the "priority" (like play the most higher rated song first) or the "intensity" (from low to high) of the shuffle?
    Got the last 7th gen. Ipod Nano.

    On the iPod's Now Playing screen, there is a Shuffle button.  The symbol looks like two arrows crossing.  Is that set to ON? 
    I ask this because shuffing a playlist should NOT always put the same 20-30 songs at the top of the list. Shuffle means a randomly ordered list is created and played.  If the original playlist is in a somewhat random playlist order to begin with, playing it in play-in-order mode may seem like it is shuffling, even though the iPod is playing the list in playlist order.  And the same songs would be at the top of the list every time, because the iPod not shuffling the list.
    Sorry if that's too basic, but I need to ask the obvious question first, and that question is, IS is the iPod actually set to shuffle songs?

  • WRT54GS: without Windows, force a given MAC address to always get the same IP address via DHCP?

    I have just now set up my WRT54GS to manage my home wireless network, and it works great. I just have one question that I haven't been able to find an answer for (forgive me if I have overlooked an obvious source of information).
    I have set up the WRT54GS to be a DHCP server, and it assigns addresses in an ad hoc manner to all the devices that connect to it. In general, this is what I want, but in one case, I want a certain host to always get the same IP address, for example, 192.168.1.10.
    You should know that I have no Windows machines on my network. Everything is either running Linux, MacOSX, or Symbian (on a Nokia N95 handheld). Therefore, I can't set up a static IP for my device using the software supplied on the CD that comes with my router, as that software only runs under Windows.
    Using a different manufacturer's router, I am able to accomplish this by telling the DHCP software on that router to always assign 192.168.1.10 to the host who connects with a certain MAC address. I can then use this mechanism to force my specific host to always get this desired IP address. However, I haven't been able to find any way to do that with the WRT54GS without the software on the Windows-based CD. Is it possible at all? If I can indeed do this without that Windows software, could someone point me to some docs which explain how to accomplish this?
    ... or is there perhaps a different way to cause this to happen, perhaps by means of some sort of DHCP client ID?
    Thank you very much in advance for any pointers you can give me.
    Message Edited by HippoMan on 10-16-2007 05:27 PM
    Take a hippopotamus to lunch today.

    Forget about the CD. There is nothing on the CD which you don't configure better through the router web interface at http://192.168.1.1/ You don't need the CD. Never. I have never used the CD to configure any of my routers. The program on the CD is just a software which helps you with the initial configuration of the router. It is just a software which pretty much contacts the web interface in the background and sends some settings changes there. You can do everything yourself directly. Then you know what you change.
    You have to configure the static IP address on the computer and on the computer only, e.g. on your Mac use Static IP instead of DHCP in the network preferences. Enter the IP address you want to use for the computer, the subnet mask, gateway address and DNS server(s). That's it. The router is not involved in any of this.
    You just have to make sure that you use an IP address inside the LAN of the router. By default, Linksys routers use the IP address 192.168.1.1 on the LAN side for the the router. The subnet mask is 255.255.255.0. The IP address together with the subnet mask says that all IP addresses 192.168.1.0-255 are considered part of the LAN. Everything else is outside and needs to be routed to the router and from there into the internet. (If you want to know how the subnet mask works exactly read the wikipedia article on it or search for "subnet calculator" or similar in the internet)
    Thus, if you connect a computer to your LAN and set a static IP address on the computer it should be inside this IP address subnet/range in order to have internet and LAN access on the computer. It does not matter which address you use as long as it is inside the IP subnet. The DHCP server on the router automatically assign a correct IP address inside the IP subnet and also automatically assigns the correct gateway address (its own address = the address to which everything should be sent which does not belong into the LAN, i.e. the internet traffic) and the DNS server. With static IP you have to assign those values yourself.
    But again, there is no Windows computer or CD involved to do that nor is there any configuration on the router required to set the static IP address on the Mac. The IP address you set must simply match your LAN IP which is basically defined through the settings on the router as you want to have internet and thus need access to the router and its address 192.168.1.1.
    Some routers allow you define fixed IP addresses for specific devices in the DHCP server of the router. With that function you can set a fixed IP address on the router. The computer can remain on DHCP. It will always get the IP address you have configured in the list on the router through the DHCP server. However, your Linksys router does not have this option. If any device inside your LAN is supposed to receive the same IP address at any time you have to configure that on the device only.
    If you have not changed the default LAN IP address, subnet mask and DHCP server settings on the router, the router has 192.168.1.1, subnet mask 255.255.255.0 and the DHCP server uses 192.168.1.100-149 for dynamic assignments. To avoid potential address conflicts you should not use any static IP addresses inside the DHCP server address pool. This leaves you with IP addresses 192.168.1.2-99 and 150-254 as static IP addresses inside your LAN. You can pick any address you like as long as any device with a static IP address has a unique IP address inside your LAN.
    Assign the subnet mask 255.255.255.0 on the computer and set the default gateway to 192.168.1.1. The DNS servers are a little bit more complicated. Generally it is better and faster if you use the DNS servers of your ISP. You can, however, also use the IP address of the router 192.168.1.1 as DNS server. The router will then operate as DNS proxy, i.e. it contacts the DNS servers of your ISP for any request from your computer.
    If you want to use the DNS servers of your ISP, click on the Status tab in the router web interface. It shows you the current settings of the router on the internet port. It should show you multiple entries for DNS servers. Choose those DNS server IP addresses in the computer.
    If you don't want to go through the hassle with the direct access to the DNS servers of your ISP, simple use 192.168.1.1 as only DNS server on the computer.
    There are all settings you have to make on your Mac or other computers to assign a static IP address. As long as the IP address is inside 192.168.1.* it belongs to the LAN and has internet access through the router (as long as the default gateway address is 192.168.1.1 of course).
    Firmware is loaded either through the web interface of the router, usually somewhere on the Administration tab or with tftp. Both ways work fine on any Mac or Linux box.

  • How to fetch the data & display the data if fields got the same name in alv

    hi frnds, i need ur help.
    how to fetch the data & display the data if fields got the same name in alv grid format.
    thanks in advance,
    Regards,
    mahesh
    9321043028

    Refer the url :
    http://abapexpert.blogspot.com/2007/07/sap-list-viewer-alv.html
    Go thru the guide for OOPs based ALV.
    Use SET_TABLE_FOR_FIRST_DISPLAY to display the table:
    CALL METHOD grid->set_table_for_first_display
     EXPORTING
    I_STRUCTURE_NAME = 'SFLIGHT'     “Structure data
    CHANGING
    IT_OUTTAB = gt_sflight.          “ Output table
    You can also implement
    Full Screen ALV, its quite easy. Just pass the output table to FM REUSE_ALV_GRID_DISPLAY. 
    For controlling and implementing the FS-ALV we have to concentrate on few of the components as follows :
    1. Selection of data.
    2. Prepare Layout of display list.
    3. Event handling.
    4. Export all the prepared data to REUSE_ALV_GRID_DISPLAY.
    Regd,
    Vishal

  • Sub Report in Table, always showing the same data

    I created a main report with data from a dataset. The DataSet has a column: @Region_ID. The Main Report is Page-Grouped by this @Region_ID and shows a tablix with some datarows foreach region. 
    I now want to include a subreport into the table and pass the parameter @region_ID to the subreport, which also calls a procedure including the passed @region_ID. I set the @region_ID-Parameter to "always refresh"
    I added a textbox on the subreport to display the values which has been passed to the subreport. 
    I now have a multipage report, with a page for every region. The subreport displays various @region_ids in the textbox, but the data for the subreport itsself, shows the same data on every page. It seems like it has called the procedure only once, with the
    first @region_id, and now displays this data on every page, allthough it does not match.
    Any suggestions what I did wrong?

    Hi tkrasinger,
    According to your description, you have the issues on displaying the parameter in subreport. It only shows the first value of the parameters. Right?
    In Reporting Services, when we execute a procedure with parameter, this procedure will only be executed one time. This is the reason why it shows the same value in your subreport.
    In this scenario, we can just right click on the textbox of region_id, go to
    Texobox Properties -> Action -> Go to report. Select the subreport, add the region_id as parameter in
    Use these parameters to run the Report. When you click on the textbox, the region_id will be passed to the subreport. So that the value will be displayed dynamically in the subreport. 
    Reference:
    Add a Subreport and Parameters (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Always plays the same song

    When I want to listen to one of my play list (on shuffle or not) it always plays the same song over and over and does not go to the next song in the list.
    I tried re-initiating my ITouch but it has not solved the problem. I also downloadeded the 3.o version of Itunes and the new upgrade in case that was the problem. Still an issue.
    Any advice?

    you haven't got the 'repeat' button selected by accident have you? (sounds daft but people have done it before and not realised)
    tap the screen while music is playing to bring up these controls.
    under the time and scrubber bar on the left handside, see those arrows? if they are blue (tapped once) it will repeat the whole sequence of songs (an album, a playlist, etc.) tap it again a '1' will appear on them. this repeats the current thing playing. tap it again to remove these settings.
    the arrows on the right will be highlighted blue when it's set to shuffle.
    the arrows on the left highlighted when it's set to repeat.

  • InDesign Crash always on the same page

    Hi to all,
    I've a recurrent crash of InDesign when a browse a document of many pages. The crash occurres always on the same page with this error log: inDesign Crash always on the same page - Pastebin.com
    Can you help me to understand the cause?
    Thank you so much.
    Regards,
    Paolo

    Some sort of text problem, possibly a font....
    Is the text on that page threaded to other pages? If it is you can export the story to ID tagged text, place it in a new file and see if it still crashes.

Maybe you are looking for

  • Values in the change log for activities

    Hi, Some fields "Z" that were created in the structure CRMD_ORDERADM_H and had the flag "change document" checked in data element to record changes in the log of changes in activities. These fields on the screen are the picklist format and are regist

  • I installed photoshop cc 2014, but Camera Raw remains on Version 8.0. Update to 8.5 does not work.

    I installed photoshop cc 2014, but Camera Raw remains on Version 8.0. Update to 8.5 does not work.

  • My 3GS shuts down unexpectedly.

    I cannot open it unless I charge it (even if it has 80% battery). The big problem: while it is shut down, people can call me, and I never see it (the phone doesn't ring, and after openning it I see no missed calls. It even happened to me not to ever

  • IPhone 6, syncing photos

    Just got an iPhone 6 & want to transfer the photos from my old iPhone across to the new one. They've been downloaded into iPhoto & was going to use iTunes to upload them. The option isn't available. In iTunes all I get is a grey rotating circle, not

  • Master Data Loads

    Hello, Some of my master data loads failed. It gives me following error: Lock NOT set for: Loading master data attributes Attributes for characteristic "  " are locked by a terminated change run what is this lock? how to rectify the same? what can be