What's wrong with my simple syntax?

Hi, Im trying to create a var and then check it with an if
statment but its not working, whats going wrong?
var loggedin:String = new String();
loggedin = ("yes");
if (loggedin == "yes")
searchbox1.text = ("user logged in");

Your code worked for me:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
private var ac:ArrayCollection = new ArrayCollection();
public function init():void
var loggedin:String = new String();
loggedin = ("yes");
if (loggedin == "yes")
searchbox1.text = ("user logged in");
]]>
</mx:Script>
<mx:TextArea id="searchbox1"/>
</mx:Application>

Similar Messages

  • What's wrong with this simple code?

    What's wrong with this simple code? Complier points out that
    1. a '{' is expected at line6;
    2. Statement expected at the line which PI is declared;
    3. Type expected at "System.out.println("Demostrating PI");"
    However, I can't figure out them. Please help. Thanks.
    Here is the code:
    import java.util.*;
    public class DebugTwo3
    // This class demonstrates some math methods
    public static void main(String args[])
              public static final double PI = 3.14159;
              double radius = 2.00;
              double area;
              double roundArea;
              System.out.println("Demonstrating PI");
              area = PI * radius * radius;
              System.out.println("area is " + area);
              roundArea = Math.round(area);
              System.out.println("Rounded area is " + roundArea);

    Change your code to this:
    import java.util.*;
    public class DebugTwo3
         public static final double PI = 3.14159;
         public static void main(String args[])
              double radius = 2.00;
              double area;
              double roundArea;
              System.out.println("Demonstrating PI");
              area = PI * radius * radius;
              System.out.println("area is " + area);
              roundArea = Math.round(area);
              System.out.println("Rounded area is " + roundArea);
    Klint

  • What's wrong with a simple login.jspx?

    Hello,
    I wrote a simple login.jspx page by following the indications at http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/adding_security.htm#BABDEICH
    Now, the page works with Firefox 5, but does not with IE 7. When under IE 7, the page keeps reloading giving errors about *"AdfBootStrap undefined*" or *"AdfLogger undefined".*
    What is wrong? Please note that I have already read all the threads on the forum about this issue, without actually solving my problem (I have not really seen any useful solutions there to be honest).
    Jdeveloper is 11.1.1.5.0, only adf authentication is enabled.
    The error messages are like the following ones:
    http://forums.oracle.com/forums/thread.jspa?threadID=952977&tstart=29
    thanks.
    Edited by: user10047839 on 27-giu-2011 8.07
    Changing from jspx to jsp does not solve the problem.

    Hello codeplay,
    in the source code of the page I have the following similar to your line:
    <script type="text/javascript" src="/Myapp/afr/partition/ie/default/opt/boot-11.1.1.5.0-1095.js"></script>
    No lines with SHERMAN inside.
    I could not open "/Myapp/afr/partition/ie/default/opt/boot-11.1.1.5.0-1095.js" or
    "afr/partition/ie/default/opt/boot-11.1.1.5.0-1095.js". Page not found
    Why does it happen with login page only?
    In firefox, as opposite to ie, where the page is rendered a little better (not as good as it should be though, due to these problems), I can login and be redirected to the secured main page, which is another .jsp, more complex than the simple login page, and there I have no problems at all.
    I noticed that the badly rendered page has a link pointing to the generated html below. NOTE that JavaScript IS ENABLED in my IE despite what this html says at the end. I checked this twice:
    WHAT IS WRONG??????????
    <html lang="en-EN"><head><script>
    ** Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
    * This is the loopback script to process the url before the real page loads. It introduces
    * a separate round trip. During this first roundtrip, we currently do two things:
    * - check the url hash portion, this is for the PPR Navigation.
    * - do the new window detection
    * the above two are both controled by parameters in web.xml
    * Since it's very lightweight, so the network latency is the only impact.
    * here are the list of will-pass-in parameters (these will replace the param in this whole
    * pattern:
    * viewIdLength view Id length (characters),
    * loopbackIdParam loopback Id param name,
    * loopbackId loopback Id,
    * loopbackIdParamMatchExpr loopback Id match expression,
    * windowModeIdParam window mode param name,
    * windowModeParamMatchExpr window mode match expression,
    * clientWindowIdParam client window Id param name,
    * clientWindowIdParamMatchExpr client window Id match expression,
    * windowId window Id,
    * initPageLaunch initPageLaunch,
    * enableNewWindowDetect whether we want to enable new window detection
    * jsessionId session Id that needs to be appended to the redirect URL
    * enablePPRNav whether we want to enable PPR Navigation
    var id = null;
    var query = null;
    var href = document.location.href;
    var hashIndex = href.indexOf("#");
    var hash = null;
    /* process the hash part of the url, split the url */
    if (hashIndex > 0)
    hash = href.substring(hashIndex + 1);
    /* only analyze hash when pprNav is on (bug 8832771) */
    if (false && hash && hash.length > 0)
    hash = decodeURIComponent(hash);
    if (hash.charAt(0) == "@")
    query = hash.substring(1);
    else
    var state = hash.split("@");
    id = state[0];
    query = state[1];
    href = href.substring(0, hashIndex);
    /* process the query part */
    var queryIndex = href.indexOf("?");
    if (queryIndex > 0)
    /* only when pprNav is on, we take in the query from the hash portion */
    query = (query || (id && id.length>0))? query: href.substring(queryIndex);
    href = href.substring(0, queryIndex);
    var jsessionIndex = href.indexOf(';');
    if (jsessionIndex > 0)
    href = href.substring(0, jsessionIndex);
    /* we will replace the viewId only when pprNav is turned on (bug 8832771) */
    if (false)
    if (id != null && id.length > 0)
    href = href.substring(0, href.length - 10) + id;
    var isSet = false;
    if (query == null || query.length == 0)
    query = "?";
    else if (query.indexOf("_afrLoop=") >= 0)
    isSet = true;
    query = query.replace(/_afrLoop=[^&]*/, "_afrLoop=12570889997779");
    else
    query += "&";
    if (!isSet)
    query = query += "_afrLoop=12570889997779";
    /* below is the new window detection logic */
    var initWindowName = "_afr_init_"; // temporary window name set to a new window
    var windowName = window.name;
    // if the window name is "_afr_init_", treat it as redirect case of a new window
    if ((true) && (!windowName || windowName==initWindowName ||
    windowName!="1bvr27bkx4_1"))
    /* append the _afrWindowMode param */
    var windowMode;
    if (false)
    /* this is the initial page launch case,
    also this could be that we couldn't detect the real windowId from the server side */
    windowMode=0;
    else if ((href.indexOf("/__ADFvDlg__") > 0) || (query.indexOf("__ADFvDlg__") >= 0))
    /* this is the dialog case */
    windowMode=1;
    else
    /* this is the ctrl-N case */
    windowMode=2;
    if (query.indexOf("_afrWindowMode=") >= 0)
    query = query.replace(/_afrWindowMode=[^&]*/, "_afrWindowMode="+windowMode);
    else
    query = query += "&_afrWindowMode="+windowMode;
    /* append the _afrWindowId param */
    var clientWindowId;
    /* in case we couldn't detect the windowId from the server side */
    if (!windowName || windowName == initWindowName)
    clientWindowId = "null";
    // set window name to an initial name so we can figure out whether a page is loaded from
    // cache when doing Ctrl+N with IE
    window.name = initWindowName;
    else
    clientWindowId = windowName;
    if (query.indexOf("_afrWindowId=") >= 0)
    query = query.replace(/_afrWindowId=\w*/, "_afrWindowId="+clientWindowId);
    else
    query = query += "&_afrWindowId="+clientWindowId;
    var sess = "";
    if (sess.length > 0)
    href += sess;
    /* if pprNav is on, then the hash portion should have already been processed */
    if ((false) || (hash == null))
    document.location.replace(href + query);
    else
    document.location.replace(href + query + "#" + hash);
    </script><noscript>JavaScript is not enabled in your browser.</noscript></head></html>

  • What's wrong with this simple method

    i'm having compile troubles with this simple method, and i think it's got to be something in my syntax.
    public String setTime()
    String timeString = new String("The time is " + getHours() + ":" + getMinutes() + ":" + getSeconds() + " " + getIsAM());
    return timeString;
    this simple method calls the get methods for hours, minutes, seconds, and isAM. the compiler tells me i need another ) right before getSeconds(), but i don't believe it. i know this is a simple one, but i could use the advice.
    thanks.

    Hi,
    I was able to compile this method , it gave no error

  • What is wrong with this simple PL/SQL..

    Hello,
    I made a PL/SQL to recreate user (if user exits already, then drop/recreate)
    I run this script and it won't drop the existed user as expected, what is wrong..?
    run like:
    $ sqlplus system/password@dbname @create_user.sql 'A1' --A1 is a user who already existed.
    conn /as sysdba
    SET FEEDBACK OFF SERVEROUTPUT ON VERIFY OFF TERMOUT OFF
    DECLARE
    v_count INTEGER := 0;
    v_statement VARCHAR2 (200);
    BEGIN
    SELECT COUNT (1)
    INTO v_count
    FROM dba_users
    WHERE username = UPPER ('&1');
    IF v_count != 0
    THEN
    EXECUTE IMMEDIATE ('DROP USER &1 CASCADE');
    END IF;
    v_statement :=
    'CREATE USER &1 IDENTIFIED BY &1'
    || ' DEFAULT TABLESPACE USER_DATA'
    || ' TEMPORARY TABLESPACE TEMPORARY_DATA'
    || ' PROFILE DEFAULT ACCOUNT UNLOCK';
    EXECUTE IMMEDIATE (v_statement);
    -- Grant permissions
    EXECUTE IMMEDIATE ('GRANT READ_USER TO &1 WITH ADMIN OPTION');
    EXECUTE IMMEDIATE ('ALTER USER &1 DEFAULT ROLE ALL');
    EXECUTE IMMEDIATE ('GRANT CREATE PUBLIC SYNONYM TO &1');
    EXECUTE IMMEDIATE ('GRANT CREATE DATABASE LINK TO &1');
    EXECUTE IMMEDIATE ('GRANT CREATE SNAPSHOT TO &1');
    EXECUTE IMMEDIATE ('GRANT CREATE TABLE TO &1');
    EXECUTE IMMEDIATE ('GRANT DROP PUBLIC SYNONYM TO &1');
    EXECUTE IMMEDIATE ('GRANT QUERY REWRITE TO &1');
    EXECUTE IMMEDIATE ('GRANT RESTRICTED SESSION TO &1');
    EXECUTE IMMEDIATE ('GRANT SELECT ANY DICTIONARY TO &1');
    EXECUTE IMMEDIATE ('GRANT SELECT ANY TABLE TO &1');
    EXECUTE IMMEDIATE ('GRANT UNLIMITED TABLESPACE TO &1');
    EXECUTE IMMEDIATE ('GRANT SELECT ON SYS.CHANGE_TABLES TO &1');
    EXECUTE IMMEDIATE ('GRANT SELECT ON SYS.DBA_SUBSCRIBED_TABLES TO &1');
    EXECUTE IMMEDIATE ('GRANT SELECT ON SYS.DBA_SUBSCRIPTIONS TO &1');
    EXECUTE IMMEDIATE ('GRANT EXECUTE ON SYS.DBMS_CDC_PUBLISH TO &1');
    EXECUTE IMMEDIATE ('GRANT EXECUTE ON SYS.DBMS_CDC_SUBSCRIBE TO &1');
    EXECUTE IMMEDIATE ('GRANT EXECUTE ON SYS.DBMS_CDC_UTILITY TO &1');
    EXECUTE IMMEDIATE ('GRANT EXECUTE ON SYS.DBMS_LOCK TO &1');
    EXECUTE IMMEDIATE ('GRANT EXECUTE ON SYS.DBMS_SYSTEM TO &1');
    EXECUTE IMMEDIATE ('GRANT EXECUTE ON SYS.DBMS_UTILITY TO &1');
    EXECUTE IMMEDIATE ('GRANT READ, WRITE ON DIRECTORY SYS.PUBLIC_ACCESS TO &1 WITH GRANT OPTION');
    DBMS_OUTPUT.put_line (' ');
    DBMS_OUTPUT.put_line ('User &1 created successfully');
    DBMS_OUTPUT.put_line (' ');
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line (SQLERRM);
    DBMS_OUTPUT.put_line (' ');
    END;
    Exit;
    EOF
    Thank you
    Jerry

    Hi,
    I try to run this command in a shel scriptl, following this pl/sql excuting is a exp core shcema/imp to this user by using pipe.
    (--this part is working well)
    so I try to debug the pl/sql part first that is why I didn't use & or &&, which need to interactive with computer on scene, but this shell script will run automatically by scheduler.
    this is the whole shell,
    #!/bin/ksh
    INPUT_DATABASE_SCHEMA=$1
    OUTPUT_DATABASE_SCHEMA=$2
    TARGET_DATABASE=$3
    #drop/recreate user $2
    sqlplus system/$3@$3 @create_user.sql '$2' ---this is also the question? how make it as real variable $2, not literal
    #exp
    mknod ./$1_exp p
    gzip < $1_exp > ./$1_exp.dmp.gz &
    exp \
    rows=y \
    userid=system/$3@$3 \
    owner=$1 \
    log=$1_exp.log \
    file=$1_exp \
    direct=y \
    recordlength=65535 \
    statistics=none \
    consistent=y \
    compress=n \
    grep 'ORA-' $1_exp.log
    if [ $? = 0 ]
    then
    mail -s "Problem in regression snapshort export" email < $1_exp.log
    fi
    #imp
    mknod ./$1_exp p
    gunzip < $1_exp.dmp.gz > $1_exp &
    imp \
    userid=system/$3@$3 \
    file=$1_exp \
    log=$2_IMP.log \
    buffer=500000000 \
    ignore=y \
    commit=y \
    fromuser=$1 \
    touser=$2 \
    feedback=100000 \
    GRANTS=n \
    grep 'ORA-' $2_IMP.log
    if [ $? = 0 ]
    then
    mail -s "Erros found in regression snapshort import" email < $2_IMP.log
    else
    mail -s "regression snapshort is done sucessfully" email < $2_IMP.log
    fi
    #recompile invalid
    sqlplus system/$3@$3 << EOF
    conn /as sysdba
    @?/rdbms/admin/utlrp.sql
    Exit;
    EOF
    thank you in advance

  • Can anyone tell me what is wrong with the simple sql?

    Hi,
    I have a simple SQL (see attached). It returns records when it does not include the Order By sorting clause. However, if it includes the Order By clause, Oracle says no data found. Anyone can give me some ideas what could cause the problem?
    Thanks in advance.
    SELECT ih.item_key, e.episode_key, e.episode_date, wp.work_package_key, p.patient_name, c.codes_key
    FROM work_package wp, episodes e, item_header ih, patients p, codes c, station_element se, station_data sd
    WHERE wp.work_item_key = e.episode_key
    and e.episode_key = ih.item_key
    and ih.logical_parent_key = p.patient_key
    and e.episode_type = c.code_value
    and wp.asgn_station_key = se.item_key
    and se.station_name like 'DICT FIX%'
    and sd.station_key = wp.asgn_station_key
    and (sd.facility = '0' or sd.facility = 1)
    and wp.on_hold <> 'Y' and c.code_type = 'CEPT'
    and c.setup_group = 1
    ORDER BY e.episode_date, e.medrec_no;

    Hmmm...can you post a SQL Plus session that demonstrates this?

  • What is wrong with my simple class program?

    Ok, I'm writing a simple class called 'Frog', which will keep track of the position enter by a user. The program will ask for the initial position for the frog. It will then ask for how many steps it want the frog to jump. Then it will output the new position of it. But for some reason, it doesn't work. It always output 0 for some reason.
    import java.io.*;
    import java.util.*;
    - frog program class.
    frog will start on a position.
    user will be prompt to ask how many jump to forward.
    public class beta
         public static void main(String args[]) throws IOException
              class Frog
              int newPos;
                   int Position () //return postion of the frog
                   return newPos;
                   void PositionStart (int newPos) //initial postion of the frog
                   newPos = newPos;
                   int Jump(int stepsForward, int newPos)
                        newPos+=stepsForward;
                        return newPos;
                   int PrevPos(int newPos)
                   return newPos-1;
                   int NextPos(int newPos)
                   return newPos+1;
                   boolean isMagicSquare(int newPos)
                        if(newPos == 5) return true;
                        else return false;
         BufferedReader key = new BufferedReader(new InputStreamReader(System.in));
         Frog joe = new Frog();
         int pos = 0, stepsFoward = 0;
                   //input 1-9
                   do
                        System.out.println("Enter a position for the frog: ");
                        pos = Integer.parseInt(key.readLine()); //reads in an integer
                   }while(pos < 1 || pos > 9);
                   joe.PositionStart(pos); //initialize the position for the frog
                   System.out.println("Pos: " + joe.Position()); //position
                   System.out.println("How many steps to jump: ");
                   stepsFoward = Integer.parseInt(key.readLine());
                   joe.Jump(stepsFoward,joe.Position());
                   System.out.println("New Position: " + joe.Position());               
    }

    You have method argument parameters with the same name as a member variable; as in:
    void PositionStart (int newPos) {
            newPos = newPos;
    }You need to identify to the compiler which variable is which, class member variables in cases like this should be qualified with the this keyword; as in:
    void PositionStart (int newPos) {
            this.newPos = newPos;
    }Dave

  • What is wrong with my simple program!

    Hello everybody,
    I have a very simple Java program, but it could not run as i expect.
    Could anybody help me firgure it out ?
    Thank you very much in advance
    still_learn
    Here is my program:
    import java.io.*;
    public class Practice
    static InputStreamReader reader = new
    InputStreamReader(System.in);
    static BufferedReader keyboard = new BufferedReader
    (reader);
    public static void main(String[] args) throws
    IOException
    String response;
    do{
         System.out.println("");
         for(int i=0; i<20; i++)
         System.out.println("George Michael");
         do{
         System.out.print("Do you want to continue?
    (y/n) ");
         response = keyboard.readLine();
         }while((response != "y")&&(response != "n"));
              }while(response == "y");
    }// end of main
    }// end of class

    You didn't say what you expected, so debugging becomes very difficult. However I do notice at the end of the code that you compare two strings using == and !=. This does not work. If you want to see if two strings have the same content, use the equals() method of the String class. In your case:}while((!response.equals("y"))&&(!response.equals("n")));
    }while(response.equals("y");

  • What is wrong with this simple CFIF statement?

    Hi, I've included a simple cfif statment to check to see if a
    user is already in the database, for some reaons the <cfelse>
    part of the statement does not work. that is, if the user is there
    it returns the recordcount and ID etc. but if it is a new user (no
    records found) it is just blank (without the nothing doing !!!) any
    ideas?
    Thanks
    Yankee

    Based strictly on the code you have shown, you do not need
    the query="getuser" in your cfoutput tag.
    Also, I would check to see if the value is greater than zero
    rather than equal to one. What if the person has more than one
    record in the database?
    Try this...
    <CFIF getuser.recordcount GT 0>
    #GetUser.RecordCount# Records Found
    <CFELSE>
    Doing Nothing
    </CFIF>

  • What is wrong with this simple query

    Hi,
    I am writting a simple code just to get the maximum no values from a database table
    The query is
    ResultSet = stm.executeQuery("SELECT MAX(column_name) FROM Database_table ");
    it seems to be a simple one but i am getting the message
    column not found
    Please answer soon

    Well, it depends on how your resultset is retrieving the results. If you retrieve by column name, then that's your problem. You need to do something like this:
    ResultSet = stm.executeQuery("SELECT MAX(column_name) AS myColumnName FROM Database_table ");
    String myResult = ResultSet.getString(myColumnName);Using MAX, COUNT, etc, will return your result with a mangled or no actual column name to retrieve from. Optionally, you can solve your problem by:
    ResultSet.getString(1);Michael Bishop

  • What's wrong with this simple java file

    I am learning java input methods. When I tried to compile the below simple java file, there were two errors.
    import java.io.*;
    public class MainClass {
       public static void main(String[] args)  {
        Console console = System.console();
        String user = console.readLine("user: ");
        System.out.println(user);
    }The compiler errors:
    h:\java\MainClass.java:5: cannot resolve symbol
    symbol : class Console
    location: class MainClass
    Console console = System.console();
    ^
    h:\java\MainClass.java:5: cannot resolve symbol
    symbol : method console ()
    location: class java.lang.System
    Console console = System.console();
    ^
    2 errors
    Could anyone take a look and shed some lights on this?

    I have changed to "import java.io.Console;" but this below errors:
    h:\java\MainClass.java:1: cannot resolve symbol
    symbol : class Console
    location: package io
    import java.io.Console;
    ^
    h:\java\MainClass.java:5: cannot resolve symbol
    symbol : class Console
    location: class MainClass
    Console console = System.console();
    ^
    h:\java\MainClass.java:5: cannot resolve symbol
    symbol : method console ()
    location: class java.lang.System
    Console console = System.console();
    ^
    3 errors
    -----------

  • What is wrong with this simple JSP code?

    Whenever I run it on a browser it goes the SQL exception, but when I run it in a Java compiler it works fine.
    Any help very much appreciated
    <head>
    <%@ page
         import = "java.io.*"
         import = "java.lang.*"
         import = "java.sql.*"
    %>
    <title>
    JSP Example 2
    </title>
    </head>
    <body>
    <h1>JSP Example 2</h1>
    <%
    try
    // Load the driver class
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         try
         // Define the data source for the driver
              String sourceURL = "jdbc:odbc:my_library";
         // Create a connection through the DriverManager
              Connection databaseConnection = DriverManager.getConnection(sourceURL,"","");
              out.println("Here");
         Statement statement = databaseConnection.createStatement();
         ResultSet authorNames = statement.executeQuery("Select * from tblAvailable_Items");
         catch (SQLException s)
              out.println("SQL Error<br>");
         catch (ClassNotFoundException err)
              out.println("Class loading error");
    %>
    </body>
    </html>

    Hi...
    I have made some modifications to your code.. Try this. I assume, you would configured the system dsn as my_library, a table name "Table1" with one of the fields name as "name"
    <head>
    <%@ page import = "java.io.*,java.lang.*,java.sql.*" %>
    <title>
    JSP Example 2
    </title>
    </head>
    <body>
    <h1>JSP Example 2</h1>
    <%
    try
    // Load the driver class
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    try
    // Define the data source for the driver
    String sourceURL = "jdbc:odbc:my_library";
    // Create a connection through the DriverManager
    Connection databaseConnection = DriverManager.getConnection(sourceURL,"","");
    out.println("Here");
    Statement statement = databaseConnection.createStatement();
    String sql = "select * from Table1";
    ResultSet authorNames = statement.executeQuery(sql);
    while (authorNames.next()){
                             String Name = authorNames.getString("name");
    out.println(Name);
    catch (SQLException s)
    out.println("SQL Error<br>");
    catch (ClassNotFoundException err)
    out.println("Class loading error");
    %>
    </body>
    </html>
    Regds
    Vasi

  • What's wrong with my simple IO code?

    import java.io.*;
    public class test4
    public static void main(String arg[])throws IOException
    File f=new File("u:/temp.txt");
    f.createNewFile();
    FileWriter fwriter=new FileWriter(f,true);     
    fwriter.write("can you see me?");
    }

    You have to close your, and you really should flush,
    your fwriter before sending any data to file:You mean after sending any data, right? ;)
    fwriter.flush();
    fwriter.close();I suppose it doesn't hurt to be explicit, but the flush() isn't strictly necessary as close() flushes the stream before closing it (as per the API docs). I'll leave it to you as to what level of verbosity you want.

  • What is wrong with this simple for loop?

    long number = 12345678;
            for(int i=1;i<=numberOfDigits;i++)
                int i = number/(i);
            System.out.println(i);
            Basically, I want to take to assign int 1 = , int 2 = , int 3 = up until the number of digits.
    I still have to manipulate it, so the code makes no sesne, but how would I do that?
    So, i want to assign ints up until 8 but the manipulation I have also involves i up until the number of digits.
    Yhank you.

    Fredddir_Java wrote:
    I see that, but I just wanted to declare 8 ints (in this example, number of digits is 8) using a for loop, so I wanted to use the loop to assign these values one at a time. You know...but don't declare a variable with the same name as the loop variable. That just won't compile. Use an array as mentioned above.
    How would you do that?If you are trying to find the digit at a certain point in your number, probably the easiest way is to translate the number to a Stirng and use String methods (if allowed) such as charAt(...). If not, then look at the mod operator "%" and at integer division.
    Can anyone provide a basic loop for this task?Best not to ask for a code solution to homework here. We'll tolerate specific questions but not requests for code.

  • What is wrong with this simple getText

    Alright, all im trying to do now is to have the user enter in a c d or f for their seat. If they do and everything else is correct, it should place an X in the array. However, even if i do a c d or f, it still goes to the else clause and never performs the intended if structure. I tried with integers and it worked fine, but our prof
    insists we use letters. Please help
    public void actionPerformed (ActionEvent actionEvent) {
    int RowNumber = 0, Section = 0;
    String Seat = "a"; <------------------------------------------declare seat as a string initiated as "a"
    if (actionEvent.getSource() == btnClear){
    txtSeat.setText("");
    txtSection.setText("");
    txtRow.setText("");
    if (actionEvent.getSource() == btnReserve){
    try{
    Section = Integer.parseInt(txtSection.getText());
    RowNumber = Integer.parseInt(txtRow.getText());
    Seat = (txtSeat.getText());<--------------------------------------get the text from txtSeat and put in Seat
    catch(Exception exception){
    JOptionPane.showMessageDialog(null, " Please enter a valid input in each box.");
    if(Section == 1){
    if(RowNumber >= 1 && RowNumber <= 3){
    if(Seat == "a" || Seat == "c" || Seat == "d" || Seat == "f"){<--------------Skips this even if its acd or f
    if(Business[(RowNumber-1)][0] == '0'){
    Business[(RowNumber-1)][0] = 'X';
    JOptionPane.showMessageDialog(null, "Seat has been Reserved.");
    displayChart();
    else JOptionPane.showMessageDialog(null, "Seat is already Reserved.");
    else
    { JOptionPane.showMessageDialog(null, "Please enter a seat A, C, D, or F" + <---------goes here
    " for Business class.");

    1) When posting code use the [url http://forum.java.sun.com/features.jsp#Formatting]Formatting Tags so the code is readable.
    2) if(Seat == "a" || Seat == "c" || Seat == "d" || Seat == "f")
    You don't use "==" when comparing equality of two Objects you use the equals(...) method.
    if (seat.equals("a") ....
    The "==" operator is only used when comparing primitive data types (int, char, long...)
    3) Variable names should not start with an upper case character. Normally class names would start with an upper case character (look at all the classes in the API).

Maybe you are looking for

  • Index Statistics Update - Problem

    We had performance problem yesterday with FI report FAGLL03, it timed out in online execution and in background mode it took 5000+ sec to execute. Result was no more than 100 records. Later with some investigation problem drill down to index usage of

  • Using Breaks/Context operators in WebI

    Hi guys,                         Had an urgent question that i needed help with. Right now in WebI i have a table with a column giving end times for Example: End Time 5:02 AM 5:44 AM 6:05 AM 6:15 AM 6:45 AM 7:10 AM 7:22 AM Instead of detailed times i

  • No longer able to include a photo in text message

    All of a sudden the option to text a photo when viewing it on my phone has disappeared.  Any suggestions?

  • Using WMV on a Website Won't Work...

    I'm trying to open a video on a website (no, not that kind of video...) and it uses WMV. So I have tried downloading it for Mac and it doesn't work. I also tried Flip4Mac and VLC but nothing is working. How do I download something to get this video t

  • Unwanted Contact Requests (Ongoing history within ...

    Upon reading Primemover's [Power User] ‎25-07-2012 20:39 - edited ‎25-07-2012 20:52 response to "How to Handle Unwanted Contact Requests" (reference : http://community.skype.com/t5/Security-Privacy-Trust-and/How-to-Handle-Unwanted-Contact-Requests/m-