Problem with "System.in.read()" read() method!

import java.io.*;
import java.lang.*;
class Count {
public static void main(String args[]) throws IOException
int count = 0;
while (System.in.read()!=-1)
count++;
System.out.println("Input has " + count + " chars.");
in this code the loop stucks and it increments the count variable infinitely of course as long as i hit enter. I am trying to understand the problem with read() method of system class's in object. in its definition it says; when the inputstream ends it returns -1, but in this code it does not return -1 ever. another question of mine is that what args[] array do? what does it store??

Java doesn't bother much with the dos console and it a bit limited and limiting - no pretty colours /graphics options - just text - that's because java graduates to GUI's where there is laods of power and object /component support to do everything and everything you could imagine and more. System.in.read() ??? - thats a fine start!
what args[] array do? what does it store??
Good question !
It provides a means of passing a parameter argument from the command line to the program - consider this;-public class HelloWithArgs {
   public static void main(String[] args) {
      System.out.println("Hello I am " + args[0]);
}What does it do and how does it work? Or this;-public class HelloWithArgs2 {
   public static void main(String[] args) {
      try{
         String myName = args[0];
      catch(ArrayIndexOutOfBoundsException aob){
          System.out.print("No names: program will end");
          System.exit(0);
      System.out.println("Hello I am " + myName);
}Study them and have fun. Though to answer the question -
" public static void main(String[] args) {" // or
" public static void main(String[] parameters) {"
is the 'entry point' of all java programs, in order to do something it has to have a main() method and if youre going to pass on parameters, then why not a String array? If you think about it anything else would be fairly useless.

Similar Messages

  • Problems with SharePoint2010 and Adobe Reader X

    hi all,
    i have a big problem with SharePoint2010 and Adobe Reader x. We can open .pdf Files from SharePoint but not Safe. The Error Message is "
    SharePoint, SQL and OS are installed in English. The problem is that the site was probably created from a German template. One would have to create the site from an English template and then add the other languages by MUI. It is a matter which language site in the settings under Language Settings is uppermost to:
    how can the problem be solved?it looks like here, the reader still an error..
    andre

    Hi,
    Could you repost the error-message that you see in Adobe Reader? The problem might be because of a known bug in Microsoft SharePoint server 2010. Certain required field types are missing in the German/French site templates which cause a SOAP request on the server to fail. A workaround is to add these field types to the library. You could add these fields manually or using a script. You could look for following field types which might be missing from the site template.
    "Content Type ID","Approver Comments","Name","Document Modified By","Document Created By","File Type","HTML File Type","Source URL","Shared File Index","Title","Template Link","HTML File Link","Is Signed", "Document ID Value", "Document ID", "Content Type", "Created", "Created By", "Modified", "Modified By", "Has Copy Destinations", "Copy Source", "Approval Status", "URL Path", "File Size", "Item Type","Sort Type", "Effective Permissions Mask", "ID of the User who has the item Checked Out", "Is Checked out to local", "Checked Out To", "Unique Id", "Client Id", "Virus Status", "Check In Comment", "Edit Menu Table Start", "Edit Menu Table End", "Server Relative URL", "Encoded Absolute URL", "Property Bag", "Level", "Is Current Version", "Item Child Count", "Folder Child Count", "Select", "Edit", "UI Version", "Instance ID", "Order", "Workflow Version", "Workflow Instance ID", "Source Version (Converted Document)", "Source Name (Converted Document)", "Document Concurrency Number","Relink", "Merge", "Path"
    Thanks,
    Richa

  • Problems with my Acrobat IX reading images

    I have just started having problems with my Acrobat IX reading images.  I have now noticed that when I open up a PDF, the images are now blacked out with a black box. These are all documents that I have been able to read just fine in the past.  I have done some research online and have found others who are having the same problem but I cannot find a solution.  Some solutions I have found are to make sure on the printer settings that it reads large images which I have done and that it prints in color which I have also done.  When I print out the document, it prints just fine, I just cannot read it on the screen.
    Please any help would be greatly appreciated.

    Thank you so much for taking the time to respond but nope. unfortunately I have tried that a few times, both clicking and unclicking the view large images with no luck. Since I have Acrobat IX Adobe wont help me.  Any other suggestions? Should I just uninstall and reinstall this program?? When I Google this problem it appears that a lot of people are having this problem.

  • When installed JDK but I have problem with System vars may install bundle

    When installed JDK but I have problem with System vars may install bundle [netbeans&JDK] WITHOUT UNISTALLING initial JDK or needed uninstall first ?

    With the word 'automatically', yes you do need pulseaudio. I'm sure you could cook up some udev or related rule to do that in Alsa, but pulseaudio would be easier.

  • Problems with loading native library missing methods ttJdbc1122.dll

    Problems with loading native library/missing methods: C:\TimesTen\tt1122_64\bin\ttJdbc1122.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
    Hi,
    I have installed TimesTen 11.2.2 64-bit version on 64-bit windows 7.
    I have TimesTen 7 64-bit as well installed on my machice
    When trying to connect to TimesTen (Direct connection) using jdbc from eclipse, I get the following error "Problems with loading native library/missing methods: C:\TimesTen\tt1122_64\bin\ttJdbc1122.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform".
    The JDK version is 1.6.25 - 64 bit version.
    Please help me resolving this error.
    Thanks in Advance,
    Balamurugan

    Are you using SQL Developer?
    There is or used to be a restriction of only being able to using 32 bit. A suggestion might be to try the 32 bit client.

  • Problems with System Update 3.14.0019 after installation SP2

    Have you encountered problems with System Update 3.14.0019 after installation SP2 for Windows Vista?
     After this upgrade I view  this error: "An error occurred while gathering user information."
    Thanks for the help

    A known issue.  It wasn't supposed to be supported until SP2 is RTM.  However, look at the stickied post in the forum for some bad news about SU.
    x61s

  • Hello, I have problems with app store Your payment method is not valid in this Store. Please enter a new payment method. Could you help me, please?

    I have tried 3 cards already but still the same problem with app store Your payment method is not valid in this Store. Please enter a new payment method.
    Is there any ways to solve the issue?
    Thank you in advance for your help!

    If you still have problem, contact iTune Support
    https://ssl.apple.com/emea/support/itunes/contact.html

  • Problems with loading native library/missing methods: no ttJdbcCS1121

    Hi guys,
    Im getting this problem in glassfish 2.1, but in glassfish 3 or in tomcat, i dont get this problem. (Windows)
    Any thoughts?
    java.sql.SQLException: Problems with loading native library/missing methods: no ttJdbcCS1121 in java.library.path
    at com.timesten.jdbc.JdbcOdbcConnection.connect(JdbcOdbcConnection.java:1750)
    at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:305)
    at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:161)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:193)
    at com.summitinvt.mdaq.db.handler.DBConnector.getConnection(DBConnector.java:108)
    at com.summitinvt.mdaq.db.handler.DBConnector.initiateConnection(DBConnector.java:101)
    at com.summitinvt.mdaq.db.handler.DBConnector.<init>(DBConnector.java:34)
    at com.summitinvt.mdaq.db.handler.DBConnector.<init>(DBConnector.java:14)
    at com.summitinvt.mdaq.db.handler.DBConnector$DBConnectorUtil.<clinit>(DBConnector.java:24)
    at com.summitinvt.mdaq.db.handler.DBConnector.getInstance(DBConnector.java:28)
    at com.summitinvt.mdaq.rats.server.CommunicatorImpl.getPnLByCurrency(CommunicatorImpl.java:1074)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:207)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:243)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:315)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:666)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:597)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:872)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
    at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:382)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:264)
    at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
    regards
    John

    A similar problem was reported before on this Forum - see
    Re: not able create connection to timesten
    checking the Release Notes I can see 11.2.1.8.0 has been tested against Glassfish 3 but I
    can't see any mention about Glassfish 2 in the v7 or v11 Release Notes (albeit only on a quick
    search).
    In my full install on XP, ttJdbcCS1121.dll is in C:\TimesTen\tt1121_32\bin

  • Problems with loading native library/missing methods:no ttJdbcCS in java.li

    Iam facing one problem while connecting the timesten client to the server The SQL Exception which Iam getting is pasted below:-
    Problems with loading native library/missing methods: no ttJdbcCS in java.library.path
    I am working with MAC OS X 10.7.2 and my timesten client version is 11.2.1.0
    I have also changed the Java Preferences from 64-bit to 32-bit but still whenever i tried to connect with the SQL Developer it gives me the above error.

    I just tried this out. My environment is OS X 10.7.4, Timesten (32-bit) client 11.2.1.9.0, SQL Developer 3.1.07, Oracle Java 1.7.0_04.
    The key things you need to be sure to do (in a terminal window) are:
    1. Be sure to . in the TimesTen environment script <tt_install_dir>/bin/ttenv.sh to set the full TT environment.
    2. Change directory to SQLDeveloper.app/Contents/Resources/sqldeveloper
    3. Run 'sh sqldeveloper.sh -J-d32'
    and all should be fine.
    Note that if you are using Java7 as I am then there is a step 1a. Change the CLASSPATH environment variable to specify ttjdbc6.jar not ttjdbc5.jar. For some reason running the app directly from Finder does not work even if you add -J-d32 into the sqldeveloper launch script. I'm still looking into that.
    Chris

  • Problem with HTML in a read only textarea item

    I'm working on a messaging system for our site. For the body of the message, we use a standard textarea item. However, if we come to the messaging page from a certain page in our system, then we pre-load the textarea item, and make it read only. The only problem with this is that there are HTML tags in the body that we try to pre-load. This is causing problems because they aren't being interpreted as tags, but are being displayed as text. If I make the textarea editable, then everything looks fine, it's just when I set the area to be read only that it doesn't work. Any thoughts on how to fix this? Thanks!

    Not always. A user is allowed to edit that area in most circumstances except for when the user arrives at the page coming from 1 page in particular. In this case, then the field is read-only. At all other times though, it is editable.
    As a workaround, whenever I know I'm coming from this page, I set a variable, and if the variable is set, then I use a Display Only item and then hide the Textarea. If the variable is not set, then I hide my Display Only item and show the Textarea. Not very elegant, but it works.

  • Problem with printing from Acrobat Reader XI

    SInce I installed Acrobat Reader XI I have got problems with printing out pages. The text starts a bit down (2 cm) on the paper, resulting that the last part of the text on the page will be missing. And the missing part does not follow on page 2, it just don´t comes out!
    It doesn´t matter what settings i click in on the print setting page in Acrobat Reader, it always gets the same result.
    Does anyone know what can be the problem?

    No files appeared in C:\Users\Pavilion\AppData\Roaming\Adobe\Adobe PDF\Settings but they did appear in Distiller.
    I tried to copied them from C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Settings, but found they were already there.  I copied them by adding -COPY before .joboptions in the name.  Now they appeared in  Printing Preferences with the -COPY added.
    I tested a print from Word (using File / Print), but was not prompted for the filename or location.  I checked my entire system and couldn't find the PDF file anywhere.  I tried changing the Port to Desktop\*.pdf using Printer Properties, but that didn't work either.
    I was able to successfully use the Acrobat menu item in Word & Excel to create a PDF but it automatically created the file on the Desktop without an option to change the filename.
    After several days and hours, I gave up and installed Acrobat X on the W7 computer.  I can still use Acrobat XI on the W8 computer.  So be it!
    Thanks anyway for your attempts to help.

  • Having Problems With The Neo2 ? Read This!!!!

    Hi,
    i just bought a neo2 motherboard, with a p4 2,6 HT and 512 mb Kingston hyper ram ( 2 peaces of 256, else it won't use the dual bandwith :D)
    In the beginning everything seemed fine, until i got some sudden reboots and other vague stuff. I read it could be the SB audigy messing things up. I removed the card and windows Xp pro runs fine now. no more sudden reboots or explorer not resonding crashes.
    But, i still had problems with games crashing. I got reboots. After i set the "automatic reboot after crash" to false, i got blue screens or lock-ups in my games.
    I wondered what it could be. Then i started to put my videocard ( a radeon 9700 pro 128 mb) in agp 4x mode instead of agp 8x! Now my games run without crashes, but benchmarks are not that high. 4780 marks with 3dmark 2003.
    I think i will send msi and Ati a mail concerning this problem. I don't know if it is PSU related. Maybe the videocard demands a little more power in agp 8x mode.
    Well, having probs with you're NEO2 ??
    remove the sb Audigy and turn the agp back to 4 using smartgart ( it's located in you're display settings screen ).
    First i tought it was a PSU related problem, because i swapped my 350 Watt enermax with a Q-tec 400 watt psu. The 400 watt PSU died while i was gaming. Maybe the enermax is the better PSU :D So, it could still be a PSU related problem. Maybe the agp 8x settings demands a lot more from you're psu. Anyway, i'll receive a 550 watt Antec PSU soon, so i can check this out....
    Btw. I cant run the motherboard in anything better than "slow" mode. In all other modes Xp won't boot. I haven't tryed it since the AGP is at 4X, but i don't think it will matter.
    Regards,
    Welcome to the real world NEO :D

    Ok.....
    i raised the memory voltage setting in the bios from 2.65 to 2.8 and the agp voltage from 1.5 to 1.7
    Everything seems fine, but games crash back to the desktop now without an error message or the either lockup.
    Whatever i do, i can't make the mobo crash in anything but games!
    Btw. the following message caught my attention, when i ran f1 2002 with directx 8.1. Since i have directx 9, i haven't seen it anymore. Maybe because the ati-drivers are made for directx 9....
    // Watchdog Event Log File
    LogType: Watchdog
    Created: 2003-10-04 02:02:53
    TimeZone: -60 - West-Europa (standaardtijd)
    WindowsVersion: XP
    EventType: 0xEA - Thread Stuck in Device Driver
    // The driver for the display device got stuck in an infinite loop. This
    // usually indicates a problem with the device itself or with the device
    // driver programming the hardware incorrectly. Please check with your
    // display device vendor for any driver updates.
    ShutdownCount: 9
    Shutdown: 0
    EaRecovery: 1
    EventCount: 2
    BreakCount: 2
    BugcheckTriggered: 1
    DebuggerNotPresent: 1
    DriverName: ati2dvag
    EventFlag: 1
    DeviceClass: Display
    DeviceDescription: RADEON 9700 PRO
    HardwareID: PCI\VEN_1002&DEV_4E44&SUBSYS_00021002&REV_00
    Manufacturer: ATI Technologies Inc.
    DriverFixedFileInfo: FEEF04BD 00010000 0006000E 000A18EA 0006000E 000A18EA 0000003F 00000008 00040004 00000003 00000004 00000000 00000000
    DriverCompanyName: ATI Technologies Inc.
    DriverFileDescription: ATI Radeon WindowsNT Display Driver
    DriverFileVersion: 6.14.10.6378
    DriverInternalName: ati2dvag.dll
    DriverLegalCopyright: Copyright (C) 1998-2002 ATI Technologies Inc.
    DriverOriginalFilename: ati2dvag.dll
    DriverProductName: ATI Radeon Family
    DriverProductVersion: 5.2.3790.2
    I wish i had another videocard to test. My radeon 9700 pro is getting suspicious...
    Regards,
    The real world

  • Problem with fonts shown in Reader 9

    Hi,
    I have just updated my PC to Windows 7 and Adobe Reader 9.2.
    When I open PDF files I've previously viewed OK they now are shown with Adobe fonts.
    Some always, some may be OK the first time but not subsequently and some don't have the problem.
    I assume the ones that are OK were produced with a different PDF creator package?
    What's changed in Adobe 9/Windows 7?
    Thanks

    Post your question in the forum for Adobe Reader.

  • Problem With Distribuction Of Acrobat Reader 9.0 (GPO)

    We have some problems with the distribution trought GPO of reader 9.0.
    We had follow this instruction
    http://www.adobe.com/devnet/acrobat/pdfs/deploying_reader9.pdf
    http://www.adobe.com/devnet/acrobat/pdfs/gpo_ad_9.pdf
    but, if the english version work fine, the italian version its bugged.
    We have download the files exe from your website (version ITA), and we have repackaged in msi version, but when we tried to do a manual install of the msi, the program dont work fine (for example the icon its not associated correctly to pdf files, some programs for example our management software dont recognise pdf files).
    I repeat, its not a problem with GPO or our IT infrastucture, becouuse the english version its work fine. We have problems only with the italian version.
    Thanks.

    You can download  Microsoft Installer Cleanup tool from
    http://majorgeeks.com/download.php?det=4459
    regards,
    Rohit

  • Problem with Adobe Pro and Reader on terminal server

    Hi,
    We have have a Terminal Server environment with Adobe Pro and Reader. We have security for Adobe Pro, so only certain user has access to Adobe Pro and all users has access to Adobe Reader.
    Some users receive many email with pdf's attachments in Outlook and need to print these attachments. They use the Outlook function to print email and attachment automatically. The users who has access to Adobe Pro can print attachment automatically with no problem.
    The problem is user who only have access to Adobe Reader. The user can't print attachment automatically with the email, only the email is printed. But, they can open attachment and print with Adobe Reader. But, it's impossible to open each attachment because there are so many.
    Thanks for your help.
    Jonathan

    Hi,
    So if I understand correctly,
    1. You have installed Acrobat Pro & Reader on a Terminal server.
    2. You have created a security group in your Active Directory Users & Computers for users having access to Acrobat
    3. You have set permissions on C:\Program Files\Adobe\Acrobat 11.0\Acrobat\Acrobat.exe and C:\Program Files\Adobe\Acrobat 11.0\Acrobat\Acrotray.exe on the terminal server and provided access only to the security group created above.
    4. Users are accessing the Terminal server through RDWeb or connecting remotely through MSTSC (RDP) or using a .RDP file
    5. Users get emails with PDF attachments and print the mail directly without opening the PDF in Reader.
    Users check the box to print the attachments with the mail (see snapshot below):
    Some questions:
    1. What is the OS and platform (x86 or x64) of the terminal server?
    2. What are the versions of Acrobat & Reader on the terminal server?
    Thanks,
    Vinod

Maybe you are looking for

  • 2 ipods on 1 PC?

    Hi everyone, I have just bought an ipod for my partner so now we both have one, but neither of us can figure out how we can have seperate libraries as we listen to different music? Firstly, we tried installing the 2nd disk thinking we would end up wi

  • File adapter content conversion

    Hi all,   We are having File to File Scenario   We are facing problem in Content conversion in File   Adapter(Sender)   The source file is in text format and fields are   seperated by '|' character   The source file structure is :   Header|No. of Rec

  • Receiver SOAP adapter SSL error - client certificate required?

    Hi all, Problem configuring SSL in XI 3.0 NW04 SP17.... I have followed the config steps from Rahul's excellent weblog at <a href="/people/rahul.nawale2/blog/2006/05/31/how-to-use-client-authentication-with-soap-adapter">How to use Client Authenticat

  • Does Invidia optimus work with parallells

    Im planing on buying a mac, but i've been a longtime windows user and want parallells so that I can run all my windows apps, games and other stuff only capable with windows. And with the new graphics card the new macs comming with, im planing on doin

  • INSERT PICTURE USING ABAP OBJECTS

    Hello friends  , can any1 of u tel hw come can i insert a desktop picture in to the abap list using abap objecs apart frm se78... sakthi