System.out.println()'s inside implementation

Hello,
We all know the System.out.prinltn() API. But I want to know the inside implementation of System.out.println() API. Where can I get this implementation?
Furthermore, can anyone explain concretely about how to implement System.out.println()? Can you tell me in a great detail?
JohnWen604
21-June-2005

I just cannot understand what is the magic behind
d that one API can control the hardware(i.e. control
the screen to print one "simple" sentance). Do youIt's called "native OS methods". And you're not controlling anything, the graphics driver does. You're just asking the OS to ask the driver to ask the graphics card to send the appropriate signals.
think that is just just the magic of our grand new
computer? So If I can fully understand how the
hardware is controlled by the Application Program, I
will be more sensible in writing software. Just likeI doubt that. The more sensible way would be to stick to a useful level of abstraction and good design.
you know the IC's inner structure if you want to be
an qualified Electronic Engineer. Do
you think so?No.
Besides, from some OS books I know that
w that Application program written in Java will
become some OS commands that is ready for going
through the OS's command processor. I just do not
understand how that primitive Java code is written
which is OS command and can tell hardware(screen) to
print something. Do you know what that primitive Java
code is?-- The primitive Java code that is a OS
command to tell screen to print something. The
primitive java code 's examples are "+", "for",
"while", "private". The primitive java code does not
mean API.No. It's called "instructions".
What you said about setOut0(), I think
setOut0() is simply an API. Do you know the
implementation of this setout0() API? There must be
implementation and there must be the primitive Java
code. Do you agree with me?No. It's N-A-T-I-V-E. No Java code. Nowhere. Just C++ or whatever.

Similar Messages

  • System.out.println statements inside my session beans

    I have some System.out.println statements inside my session beans to track some error conditions. I would like to know where this output will be printed. Is there any text file I should look for or start up any console to see the output.
    I am running iPlanet SP3 test drive edition iPlanet Web Server 4.1 on WIndows NT machine.

    Hi,
    These statements will be printed on the kjs logs file. To view them, go to control panel-> services-> select the iPlanet Application server and click "start up" tab. Check " allow this sevice to interact with the desk top" in the service window that has been popped up. Restart the iPlanet Application server.
    View the kjs window. All your System.out.println statements will be printed out there.
    If you have any further queries please get back to the forum.
    Thanks for visiting our web forum,
    Rakesh.

  • Control Statement inside System.out.println

    I am printing something like this:
    System.out.println(parts1[0] + "|" + parts1[1]); Now, I want to keep a check i.e. if parts1[1] is say 3 I want to printout Hi and if parts1[1] is any other digit I printout Hello. [parts is obtained by using split method from data]
    Can I do it inside the print statement?

    Be judicious about this though. Unless the ternary expression and the overall argument to println are both very simple, you'll end up with an unreadable, unmaintainable mess. The only advantage to doing it all inside the println argument is compactness. If it gets unwieldy, break it up into separate statements, assign the end result to a variable, and print that.

  • How does System.out.println(). Work inside src.zip file !

    Hello guyz,
    I was just wondering how System.out.println() worked so i opened up the src.zip file and checked the source code. But could not understand it. As written i remember
    "out is an object encapsulated in the System class."
    Thats ok. But i could not understand the code.
        public final static PrintStream out = nullPrintStream();
        private static PrintStream nullPrintStream() throws NullPointerException {
         if (currentTimeMillis() > 0) {
             return null;
         throw new NullPointerException();
        }Also when i ran the DJ Decompiler it decompiled it to this:
    public class One
         public static void main(String args[])
              System.out.println("hello world");
    import java.io.PrintStream;
    public class One
        public One()
        public static void main(String args[])
            System.out.println("hello world");
    }Also, why does it need to import PrintStream ?

    Peter__Lawrey wrote:
    I was just wondering how System.out.println() worked so i opened up the src.zip file and checked the source code.This value is a place holder. This value is changed as soon as enough of the JVM is initialised for printing to work.
    Also, why does it need to import PrintStream ? It doesn't, but it is used in the code so DJ is including it just in case.Sorry,
    But i don't understand at all.

  • System.out.println in EJB

    Hi I have given System.out.println in my EJB object. But I am not able to see the output in my console. But when I give printStackTrace in my JSP(from where I can EJB)....it is displaying the exception....
    So my question is Can we give System.out... in EJB?. Should we set any property to see the output of System.out...in the console?.

    Here is my code
    From UserManager I call the EJB
    public boolean validateSignOn(String strUserName,String strPassword) throws ProdSchedException{
    try{
    UserMgrHome home = (UserMgrHome)getEJBHome("UserMgr",UserMgrHome.class);
    UserMgr userMgr = home.create();
    return userMgr.validateSignOn(strUserName,strPassword);
    catch(RemoteException rex){
    ServerLog.log(rex.getMessage(),ServerLog.ERROR);
    throw new ProdSchedException(rex,"Server Failed");
    catch(CreateException cex){
    ServerLog.log(cex.getMessage(),ServerLog.ERROR);
    throw new ProdSchedException(cex,"Create Exception");
    This is my EJB code
    import javax.ejb.*;
    import java.rmi.RemoteException;
    import java.util.*;
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.w3c.dom.*;
    import java.io.*;
    * User Manager Session Bean
    public class UserMgrEJB implements SessionBean {
    SessionContext cntx;
    public boolean validateSignOn(String strUserName,String strPassword) throws ProdSchedException{     
    UserDAO dao = new UserDAO();
         System.out.println("Inside EJB");
    boolean bValidUser = dao.validateUser(strUserName,strPassword);
    if(!bValidUser){
    throw new ProdSchedException("Invalid User");
    return bValidUser;
    //Bean methods
    public void ejbCreate(){
         System.out.println("Inside EJB Create");
    public void ejbRemove(){
    public void ejbActivate(){
         System.out.println("Inside EJB Activate");
    public void ejbPassivate(){
    public void setSessionContext(SessionContext cntx){
    this.cntx = cntx;
    This is mu UserDAO code
    public class UserDAO extends DAO{
    public boolean validateUser(String userName,String password) throws ProdSchedException{
    Connection conn = null;
    PreparedStatement stmt = null;
    ResultSet result = null;
         System.out.println("Inside validateUser in DAO");
    try{
              boolean bIsValidUser = true;
         String selectStatement = "SELECT SYSDATE from DUAL";
         conn = getConnection();
    stmt = conn.prepareStatement(selectStatement);
    result = stmt.executeQuery();
    while(result.next()){
    bIsValidUser = true;
    return bIsValidUser;
    catch(SQLException sqex){
    ServerLog.log(sqex.getMessage(),ServerLog.ERROR);
    throw new ProdSchedException(sqex,sqex.getMessage());
         finally{
    try{
    close(conn,stmt,result);
    catch(ProdSchedException slex){
                   ServerLog.log(slex.getMessage(),ServerLog.ERROR);
    throw slex;
    } // end class
    And the error I get in the console is this(since I have given printStackTrace in my JSP)
    ProdSchedException: SQL Error
    at UserDAO.validateUser(UserDAO.java:
    44)
    at UserMgrEJB.validateSignOn(
    UserMgrEJB.java:26)
    at UserMgrEJB_p3hctp_EOImpl.v
    alidateSignOn(UserMgrEJB_p3hctp_EOImpl.java:46)
    at UserManager.validateSignOn(User
    Manager.java:20)
    at jsp_servlet._public.__login._jspService(__login.java:123)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
    (ServletStubImpl.java:1094)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:437)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:319)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:5626)
    at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
    eManager.java:685)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:3213)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2555)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:251)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:219)

  • 32-bit JDK 7 System.out.println not working in IDE

    Hi folks,
    I have a 64-bit Windows 7 OS.
    Due to 3rd party library/jar dependencies, i had to install the 32-bit Java JDK 1.7 and Eclipse IDE.
    I also installed NetBeans.
    So i have a 64-bit OS and am running 32-bit Java JDK/JRE & IDEs.
    The problem I am having is that my program's System.out.println("...") statements are not outputting strings to either IDE debug console.
    Executing the compiled program from a command line/prompt produces the expected string output.
    The basic "Hello, World" program is enough to cause this behaviour to start occurring.
    I have not manually / intentionally changed any IDE-specific Debug Console or Windows environment settings.
    One caveat: This same environment has worked successfully in the past ?! Yes, this is one of those "..it worked last week & yesterday and today it isn't and i swear i didn't do anything..." issue.
    Thoughts ?

    Thanks for the reply.
    The 64-bit versions of Java & Eclipse were installed first.
    When i discovered I had to use the 32-bit versions, i un-installed the 64-bit ones & installed the 32-bits.
    Even after that initial un-install 64-bit/install 32-bit process, it was working.
    I have also been installing the Windows 7 64-bit OS updates when i am informed of them.
    I'm not sure if any of these would affect how the Eclipse / NetBeans IDEs behave.
    Behaviour has been inconsistent.
    Initially it was always working.
    But over the past several days, it has been working less and less.
    I don't have any large data structures.
    This isn't a large complicated program, couple hundred lines, so i highly doubt that i'm doing anything to the resources, but something has changed.
    The main project I am working on takes command line parameters, does some initial processing, produces output using System.out.printlns [SOP] then depending on the parameters, branches into 2 different processing paths, let's call them A & B. Each of these processing paths also use SOPs. When i run the program in the IDE going thru path A, sometimes the initial SOP statements will work and the SOP statements specific to path A will also work. If i immediately change the parameters to go thru path B & re-run it, not even the initial SOP statements before the branching decision work.
    I've tried doing System.flush()s too - no affect.
    I haven't tried the re-direction option to a file option you mentioned yet.
    It always works from a command prompt - that is telling me that the Java SOPs are working properly, correct ?
    Inside an Eclipse or NetBeans IDE, SOP output to the debug console is inconsistent.
    Running from a command prompt, the SOPs always work.
    It'd help to know if this an IDE issue, a Java issue, a Windows 7 issue so i can narrow down where to try and correct the situation.
    I have a Windows XP VM set up, i'll try running the program there and see if there's a difference.
    Thanks for your reply.

  • Strange System.out.print behavior inside a for loop

    I'm trying to create a simple ASCII progress bar in the console that would display like this:
    |--------------------------------------------|
    ============================More equal signs would appear as time goes on. At least this is what I want to happen.
    Instead, what happens is, none of the equal signs are printed until the very end, after the for loop in which the System.out.print("=") statement is in, has exited.
    This is my code (probably more than necessary is shown, but the important part is the for loop):
        public void addSomeDiffys(int numOfDiffys, int minInt, int maxInt) {
            Diffy currentDiffy;
            System.out.println("\nCreating Diffys.");
            System.out.println("|--------------------------------------------|");
            for (int i=0; i < numOfDiffys; i++) {
                currentDiffy = new Diffy(minInt, maxInt);
                if ((i/(double)numOfDiffys)*100 % 2 == 0)
                    System.out.print("=");
                diffyList.add(currentDiffy);           
            System.out.println("\n" + diffyList.size() + " Diffys created.\n");
            System.out.println("Sorting according to highest rating...");
            Collections.sort(diffyList,Diffy.HIGHEST_RATING_ORDER);
            System.out.println("Done.\n");
        }I also tried changing the System.out.print("="); to System.out.println("="); This time it works as expected, its just not very pretty...
    I get something like this:
    |--------------------------------------------|
    =
    =
    =
    =
    =
    =
    =
    =
    =
    =
    =
    =So again, when I use println, rather than print, the equal signs are printed over time, slowly, as the progress increases. When using print, Nothing happens for a long time, and then suddenly they all appear after the for loop has terminated, which makes no sense.
    Thanks for any help.

    When using print, Nothing happens
    for a long time, and then suddenly they all appear
    after the for loop has terminated, which makes no
    sense.
    Yes it does make sense! The characters are buffered inside the PrintStream and written when there is a full line to write. You could try a flush() after each = is written but I have no confidence that it will make any difference.

  • Print System.out.println messages into logs of Weblogic Application Server

    Hi,
    I use Weblogic Application Server 10.3.6 on Windows 7. The Enterprise Application (J2EE) is deployed into the 'AdminServer' of Weblogic. For debugging purpose, I have added a few System.out.println statements.
    I am unable to see the print messages on any of log files available in path 'user_projects > domains > base_domain > servers > AdminServer > logs'. However, I can see them on the 'command' prompt which was used to start the server. How can I get them into one of the log files? What am I missing?
    I tried reading other threads on the forum and as per them 'System.out.println' gets logged onto *.out logs which I am unable to find. Only base_domain.log, AdminServer.log, access.log are available in the location.
    More Specifics:
    Configuration on WLS console 'Home > Servers > AdminServer > Logging'
    Log file name: logs/AdminServer.log
    Min. Severity to log: Notice (tried with Debug as well)
    Advanced Options:
    Logging Implementation: JDK
    Redirect stdout logging enabled: False (tried both options)
    Log file Severity Level: Notice (tried with Debug as well)
    Standard Out Severity Level: Notice (tried with Debug as well)
    Thanks

    Paul,
    I just found this on google:
    'Generally, developers put a lot of System.out.println statements in their code to perform application debugging. Normally, all standard outputs and error outputs are routed to the console where the OC4J server is started. If you want to capture the standard output and error outputs to files for logging/debugging purposes, then you can use the -out and -err options while starting up the Oc4J server to specify which files to use.'.
    http://www.onjava.com/pub/a/onjava/2002/01/16/oracle.html?page=2

  • System.out.println not showing up in the console

    Hi,
    I've some System.out.println statements in a static block in a Stateless
    Session Bean. I could not see these outputs in the Weblogic console. I'm
    using Weblogic 5.1 Any one faced this problem before? any help is
    appreciated.
    Thanks & Regards,
    Nithi.

    Take a look in the weblogic log files they might be redirecting std out.
    "Ryan LeCompte" <[email protected]> wrote:
    >
    Hello Nithi,
    I'm all out of ideas, unfortunately! However, check out the following
    links for
    some possible insight into the problem:
    http://groups.google.com/groups?q=System.out.println+5.1+WebLogic&start=60&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3d3df18e%40newsgroups.bea.com&rnum=69
    http://groups.google.com/groups?q=System.out.println+5.1+WebLogic&start=70&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3977417b%40newsgroups.bea.com&rnum=71
    http://groups.google.com/groups?q=System.out.println+5.1+WebLogic&start=200&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3bc20346%241%40newsgroups.bea.com&rnum=209
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Nithi Rajan" <[email protected]> wrote:
    Hi Ryan,
    Thanks for your reply and sorry for the long silence. I was on vocation.
    Thre problem still remains.I'm very sure that the EJB
    is deployed by WebLogic as I'm able to call some methods.
    and I'm also calling EJB methods from Servlet. But my
    System.out.println statments work fine in the Servlet and
    not inside EJB (or anyother classes used by EJB).
    Any one has faced similar problems? BTW am using WebLogic 5.1
    Thanks in advance,
    Regards,
    Nithi.
    "Ryan LeCompte" <[email protected]> wrote in message
    news:[email protected]...
    Hello Nithi,
    I find it strange that your System.out.println statements are beingexecuted from
    within your servlets, but not in your stateless session bean. Are
    you
    positive
    that your EJB is being located and deployed by WebLogic? The statementsin
    your
    static { } block should be executed as soon as the WebLogic class
    loader
    finds
    the class and loads it into the JVM. I would suggest examining theconsole
    and
    try to determine if your EJB is in fact being deployed. Are you invokingmethods
    on the EJB inside of your servlets? Are you using any logging frameworkfrom within
    the EJBs which would redirect output to a file?
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Nithi Rajan" <[email protected]> wrote:
    Hi Ryan,
    Thanks for your reply. The setting in the weblogic.properties is
    as
    follows.
    weblogic.system.enableConsole=true
    So, that tells me that I should see all the System.out.printlns right?
    (Pleasecorrect me if I'm wrong). I can see all the System.out.println
    from
    my
    servletand not from the Session Bean (even if the System.out.println
    is
    outside
    static block).
    Please let me know your thoughts.
    Thanks & Regards,
    Nithi.
    "Ryan LeCompte" <[email protected]> wrote in message
    news:[email protected]...
    Hello Nithi,
    Are you sure that you don't have WebLogic configured to redirect
    all
    messages
    to a file instead of the console? Are you able to see yourSystem.out.println
    statements when placed within other methods of your stateless sessionbean? Please
    be a bit more specific.
    Thank you,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Nithi Rajan" <[email protected]> wrote:
    Hi,
    I've some System.out.println statements in a static block in a
    Stateless
    Session Bean. I could not see these outputs in the Weblogic console.
    I'm
    using Weblogic 5.1 Any one faced this problem before? any helpis
    appreciated.
    Thanks & Regards,
    Nithi.

  • Lost System.out.println statements.

    Hi
    I have few system.out.println in my jsp which i am using in my JSP provider channel. but when I look at the portal server's /var/opt/SUNWam/debug/desktop.debug file, none are there.. I looked at the web server's access and error logs too, but it is not there also.. can somebody tell me how do it get those ?? do we have any other mechanism to put debug logs ?

    By default the binary which web server runs is uxwdog which eats up System.out.println output. If you want to see the System.out.println then you need to change the product binary from the start script of the portal server instance.
    - Go to <portal-install-dir>/SUNWam/servers/https-<instance-name> and open the start script
    - Change the PRODUCT_BIN=uxwdog to PRODUCT_BIN=ns-httpd , save the file
    - Run the script ./start to start the portal server
    Note : with ns-httpd ON the server will not leave that shell, and in the same window/shell you will be able to see all your System.out.println statements. To close the server you have to kill the server process with "kill -9 pids" command
    Alternate way is to use api inside your application or jsp:
    <%@page import="com.sun.portal.providers.jsp.JSPProvider, com.sun.portal.providers.*, com.sun.portal.providers.containers.*, com.sun.portal.providers.context.*" %>
    <% JSPProvider p=(JSPProvider)pageContext.getAttribute("JSPProvider");
    ProviderContext pc = p.getProviderContext(); %>
    <%-- after that you can use these lines any where in your jsp --%>
    <%
    pc.debugError("your error msg");
    pc.debugMessage("your msg");
    pc.debugWarning("your warning msg");
    %>
    The perticular mgs will be shwon in /var/opt/SUNWam/debug/desktop.debug file as per your "debugLevel" parameter setting in /etc/opt/SUNWps/desktop/desktopconfig.properties file. By default the debugLevel is set to error so only pc.debugError("error msg") will be shown.
    Sanjeev

  • System.out.println ....syntax error?

    Hi,
    I am workin on my first java program here...and althought my classes compile just fine I can't manage to get what I want to appear on the screen on Button action....
    Clicking on cost should trigger the appearance of the total cost...but nothing happens.
    Can you have a look and tell me where I went wrong please?
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.util.*;
    public class Booking extends Applet implements ItemListener,ActionListener
    String[][] c = { {"French Language","250","130","70"}, {"Painting","270","140","70"}, {"Yoga","250","130","70"} };
    Courses courses_list = new Courses(c);
    Choice ChoiceCourse;
    Choice ChoicePeople;
    Checkbox cb1, cb2, cb3;
    boolean fulltime = false;
    boolean parttime = false;
    boolean concessions = false;
    Button b1;
    int c1;
    int p1;
    int price;
    public void init()
      add(new Label("Courses available for booking : "));
      ChoiceCourse = new Choice();
      add(ChoiceCourse);
    //the following populates the ChoiceCourse dropDown Menu with the Courses'Titles
      int i=0;
      while (i<c.length)
        ChoiceCourse.addItem(courses_list.getTitle(i));
        i++;
      ChoiceCourse.addItemListener(this);
      add(new Label("Number of participants for the course selected : "));
      ChoicePeople = new Choice();
      add(ChoicePeople);
    //the following populates the ChoicePeople dropDown Menu with "numbers" from 1 to 10
      int j=1;
      while (j<11)
        ChoicePeople.addItem(new Integer(j).toString());
        j++;
      ChoicePeople.addItemListener(this);
      cb1 = new Checkbox ("Full-Time");
      add(cb1);
      cb2 = new Checkbox ("Part-Time");
      add (cb2);
      cb3 = new Checkbox ("Concessions");
      add (cb3);
      b1 = new Button ("Cost");
      add (b1);
      b1.addActionListener(this);
      public void itemStateChanged(ItemEvent e)
       if (e.getSource() == ChoiceCourse)
         String c2 = (String) e.getItem();  // When ChoiceCourse is modified
         if (c2 == "French Language")
           int c1 = 0;
         if (c2 == "Painting")
           int c1 = 1;
         else
           int c1 = 2;
       if (e.getSource() == ChoicePeople)
         String p2 = (String) e.getItem();  // When ChoicePeople is modified
         int p1=Integer.parseInt(p2);       // converts the String into an integer
      public void actionPerformed(ActionEvent e)
        if ( e.getActionCommand() == "Cost" )
          fulltime = cb1.getState();
          parttime = cb2.getState();
          concessions = cb3.getState();
          if (fulltime == true)
            int price = 1;
          if (parttime == true)
            int price = 2;
          else
            int price = 3;
          int mode =  Integer.parseInt(c[c1][price]);  
          System.out.println("total cost of your selection is: �" + courses_list.getCost(p1,mode));
    }

    Thanks for the guidance and the explanations. I've improved my code according to your recommendations (1, 2 &3) and it compiles just fine.
    However, the println still doesn't work...but there is improvement:
    When I run my applet using the AppletViewer at the very end I get a log of what happened...and it's now showing:
    "D:\JBuilder8\jdk1.4\bin\appletviewer.exe Booking.html
    total cost of your selection is: �0"
    Which means that the println is being called but is not printing where it should be (on my screen)....the other problem is that it is obviously not properly calculating the total cost since it shouldn't be �0.
    Here is my new (improved) code, and below is the code for the Courses class (which does some of the calculation):
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.util.*;
    public class Booking extends Applet implements ItemListener,ActionListener
    String[][] c = { {"French Language","250","130","70"}, {"Painting","270","140","70"}, {"Yoga","250","130","70"} };
    Courses courses_list = new Courses(c);
    Choice ChoiceCourse;
    Choice ChoicePeople;
    Checkbox cb1, cb2, cb3;
    boolean fulltime = false;
    boolean parttime = false;
    boolean concessions = false;
    Button b1;
    int c1;
    int p1;
    int price;
    public void init()
      add(new Label("Courses available for booking : "));
      ChoiceCourse = new Choice();
      add(ChoiceCourse);
    //the following populates the ChoiceCourse dropDown Menu with the Courses'Titles
      int i=0;
      while (i<c.length)
        ChoiceCourse.addItem(courses_list.getTitle(i));
        i++;
      ChoiceCourse.addItemListener(this);
      add(new Label("Number of participants for the course selected : "));
      ChoicePeople = new Choice();
      add(ChoicePeople);
    //the following populates the ChoicePeople dropDown Menu with "numbers" from 1 to 10
      int j=1;
      while (j<11)
        ChoicePeople.addItem(new Integer(j).toString());
        j++;
      ChoicePeople.addItemListener(this);
      cb1 = new Checkbox ("Full-Time");
      add(cb1);
      cb2 = new Checkbox ("Part-Time");
      add (cb2);
      cb3 = new Checkbox ("Concessions");
      add (cb3);
      b1 = new Button ("Cost");
      add (b1);
      b1.addActionListener(this);
      public void itemStateChanged(ItemEvent e)
       if (e.getSource().equals (ChoiceCourse)) //should this be == or .equals? it doesn't work either way but compiles
         String c2 = (String) e.getItem();  // When ChoiceCourse is modified
         if (c2.equals ("French Language"))
           c1 = 0;
         if (c2.equals ("Painting"))
           c1 = 1;
         else
           c1 = 2;
       if (e.getSource().equals (ChoicePeople)) //should this be == or .equals?it doesn't work either way but compiles
         String p2 = (String) e.getItem();  // When ChoicePeople is modified
         p1=Integer.parseInt(p2);       // converts the String into an integer
      public void actionPerformed(ActionEvent e)
        if ( e.getActionCommand().equals ("Cost") )
          fulltime = cb1.getState();
          parttime = cb2.getState();
          concessions = cb3.getState();
          if (fulltime)
            price = 1;
          if (parttime)
            price = 2;
          else
            price = 3;
          int mode =  Integer.parseInt(c[c1][price]);  
          System.out.println("total cost of your selection is: �" + courses_list.getCost(p1,mode));
    class Courses
    import java.util.*;
    public class Courses
    private String[][] Listing = new String[3][4]; //create array 3 rows * 4 columns
    Courses(String[][] c)
       this.Listing=c;
    int i;
    int j;
    int p;
    int price;
    int people;
    int cost;
    String t;
    String p1;
    String getTitle(int i)  //return Course Title
       t=Listing[0];
    return t;
    int getPrice(int i, int j) //return Price (Full-Time, Part-Time, Concessions)
    p1=Listing[i][j];
    p=Integer.parseInt(p1);
    return p;
    int getCost(int pe, int pp)
    pe=price;
    pp=people;
    cost=pe*pp;
    return cost;

  • Is it possible to overide System.out.println()....

    Hi all,
    I have a program which uses System.out.println() a lot. As the whole program needed to be in GUI form, I have to abbandon the console window and print all my outputs to a special text pane which I have already created and tested.
    My problem is, is there a way for me to keep my System.out.println() statements as they are and print the outputs to my text pane instead of printing it to the console?
    Can I use some kind of overriding of System.out.println()? If so can anybody tell me how to do it?
    Thank you all in advance

    Hi again guys,
    I managed to get the system.out working. Thanks again. But I was trying to do the same to system.in using a class that inherits from InputStream and failed, can you help me out again pliz.
    following is a simplified version of the code. problem I have is that the input I get on readButton click(see the code) is always -1. The code doesn't wait for user input . How can I correct this. please help Thanx
    public class Main() implements ActionListener
        JTextPane textPane;
        JButton readButton;
        public Main()
                this.initGUI();
                Console myConsole = new Console(this.textPane);
                System.setIn(new myInputStream(myConsole));
        private void initGUI()
               this.textPane = new JTextPane();
               this.readButton = new readButton();
               this.readButton.AddActionListener(this);
                //code to create the GUI and show the textPane
               //follows
         public void ActionPerformed(ActionEvent e)
                 try
                             int keyCode = System.in.read();
                     }Catch(Exception e)
                 System.out.println("Pressed Key Code is " + keyCode);          
         public static void main(String[] args)
                   new Main();
    public class Console extends KeyListener
         JTextPane textPane;
         int pressedKey = -1;
         public console(JTextPane textPane)
                 this.textPane = textPane;
                 this.textPane.addKeyListener(this);
        public void keypressed(KeyEvent e)
                this.pressedKey = e.getKeyCode();
       public int read()
               return this.pressedKey;
    public class myInputStream extends InputStream
                Console console;
                public myInputStream(Console console)
                       this.console = console;
                public int read()
                       return this.console.read();
    }

  • System.out.println stalls my jdev

    Hello
    Is there a bug database with regards to JDeveloper 3.0?? My JDev seems to stall when I attempt to type out a "System.out.println(..)" statement. Has anyone encountered something similar?? WinNt4.0 workstation (sp5)
    Tia,
    -Robert-

    Same problem, NT 4.0. Often it stalls just when you type the open parenthesis prior to the string. My guess is it has something to do with the popup choices menu for that method. I don't know how to fix it but I'm using a clunky work-around by copying and pasting something like:
    System.out.println("");
    which includes the quotes inside the parentheses. That seems to keep the popup from trying to show up.

  • Java Beans System.out.println Log file

    Helllo,
    I have Forms 11.1.2 installed on linux. I developed a java bean and put some System.out.println() statements. The bean itself is working but where do i look for the debug statement logs that i am generating via System.out.println() statements.
    Please let me know if you need more information, I will post asap.
    thanks in advance,
    Prasad.

    Prabodh,
    thanks, added the following line to the implementation class in java bean:
    private final static Logger logger = Logger.getLogger(MyBean.class.getName());
    and then in the init() method, i put
    logger.info("Prasad .... in init);
    Does this automatically goes into weblogic managed server WLS_FORMS (in my case) standard out?
    Or do i need to do anything else, i know weblogic comes up with its own diagnostic logging and is famous for supressing other loggers.... just want to run this by you as well.
    thanks,
    Prasad,

  • Help: What can make "System.out.println" not displaying anything?

    Hello,
    We have Portal 10g.
    I have noticed a pb on the interpretation of existing JSP pages.
    I simplified the code... and I noticed that even this command doesn't work :
    <%
    System.out.println("Hello World");
    %>
    Any idea ?
    Is there any security ? permission I should get ?
    JSP works fine on our old 8i environment ...
    Thanks in advance for your help.
    Olivier

    Olivier,
    between 8i and 10g are aeons of time (for computer technology). As far as I recall, in 8i came with a Apache and JServ module. This supported Servlets and JSP through a special Oracle implementation. After that OC4J as a J2EE container for EJBs and Servlets/JSPs was introduced.
    Using JSPs with the database installation only is not advised anymore. You can use OC4J for that. But be aware that will require some changes in the configuration and deployment of JSPs.
    HTH,
    --olaf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • I'm setting up HP office jet Pro 85000 A909n, wireless radio not functioning.

    I/m using Window 7 and have printer connected to my desk top. Now I wish to print for my lap top to the printer and can not get the connection, when I run the test I get: wireless on                    Pass wireless working          Fail Messasge: th

  • How can i unlock my iphone because it says connect to itunes

    how can i unlock my iphone because it says connect to itunes

  • Oracle Standard one version problem

    Dear all My company got a Oracle Standard one 10g version license. However, after I downloaded the Oracle from OTN. When I tried to install the Oracle, I only got 'Enterprise', 'Standard' and 'Personal' option from installation. Is that mean I select

  • Error executing nqudmlexec?

    Hi Everyone, I am right in the middle of doing a BIEE install on Solaris 10 (SPARC) and I ran accross this error during the Configuration Process of the Distributing Repository: oracle.bi.installhandler.util.NQUdmlException: Error executing nqudmlexe

  • Converting string from file to array

    I'm new to LabVIEW and have been thrown into the middle of a project, so I need to get some code working fast! Can someone help me understand why the VI I've attached isn't working? I want to have a text file that contains a list of integers that wil