Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 18-01-2012
Member
 
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.
Reply With Quote
  #2  
Old 18-01-2012
Member
 
Join Date: Dec 2007
Posts: 2,273
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
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 04:20 PM.