Results 1 to 2 of 2

Thread: Data type and expressions

  1. #1
    Join Date
    Jan 2012
    Posts
    12

    Data type and expressions

    Okay so I know that In the switch statement, the selection is determined by the value of an expression that you specify, which is enclosed between the parentheses after the keyword switch. The data type of value which is returned by expression must be an integer value otherwise the statement will not compile.

    My question is what kind of a data type should "expression" be for the program to compile? Can anybody help me out with this question. And the computer language that I'm asking about is Java, just so everyone knows, please help as soon a possible.

  2. #2
    Join Date
    Dec 2007
    Posts
    2,291

    Re: Data type and expressions

    Code:
        // Compile
        CompiledExpression expr_c=null;
        try {
          expr_c=Evaluator.compile(expr,lib);
        } catch (CompilationException ce) {
          System.err.print("–––COMPILATION ERROR :");
          System.err.println(ce.getMessage());
          System.err.print("                       ");
          System.err.println(expr);
          int column=ce.getColumn(); // Column, where error was found
          for(int i=0;i<column+23-1;i++) System.err.print(' ');
          System.err.println('^');
        };
    This chunk of code is for the expression compilation. The crucial line is the call to Evaluator.compile, it is the point, where expression gets transformed into Java bytecode

Similar Threads

  1. What is the purpose of converting data type?
    By snapper in forum Software Development
    Replies: 1
    Last Post: 16-07-2010, 11:00 AM
  2. Temporal Data Type In SQL
    By Amaresh in forum Software Development
    Replies: 5
    Last Post: 02-02-2010, 08:49 PM
  3. Run-time error '3464' data type mismatch
    By Lord in forum Software Development
    Replies: 2
    Last Post: 08-09-2009, 12:09 AM
  4. DWORD data type in c
    By Zoey in forum Software Development
    Replies: 3
    Last Post: 24-08-2009, 06:33 PM
  5. When to create User Defined Data Type in VB.Net
    By Nihar Khan in forum Software Development
    Replies: 3
    Last Post: 27-02-2009, 11:29 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,616,499.73080 seconds with 17 queries