Output of this one

Output of this one


public class Test {
int i=-277;

{
try{
if(Byte i<<1)
{
System.out.println("Executed");
}
else
{
System.out.println("Error");
}

}
catch(Exception e)
{
System.out.println("exception occured");

}
}
}

View Answers

April 29, 2010 at 3:41 PM

Hi Friend,

You have declared wrong condition in if statement. Therefore it gives number of compile time errors.

The following code displays "Executed" as an output.

public class Test {
public static void main(String[]args){
int i=-277;
byte b =(byte)i;

try{
if(b<1){
System.out.println("Executed");
}
else{
System.out.println("Error");
}

}
catch(Exception e)
{
System.out.println("exception occured");

}

}
}

Thanks









Related Tutorials/Questions & Answers:
Output of this one - Java Interview Questions
Output of this one   public class Test { int i=-277; { try{ if(Byte i<<1) { System.out.println("Executed"); } else... errors. The following code displays "Executed" as an output. public class
Spliting Large XML and one by one Moved to Output Folder
Spliting Large XML and one by one Moved to Output Folder  How to Spliting Large XML and one by one Moved to Output Folder
Advertisements
output
output  Sir,I am experiencing some problems with the output of this program.I got some useful help this website,but the output of the program isn't producing what it should.let me explain the output below is what happen when
Output of flex
Output of flex  hi....... please provide the name of the output file. What is the output of flex applications? please rply ASAP........ Thanks
triangle output
triangle output  program to get the following output
output variable
output variable  if i want to print output of three variables when i wrote the code e.g SYStem.out.PRINTln(answer + answer1 + answer 2) only output of answer is getting printed out? can you help
input output
Input And Output       Introduction The Java I/O means Java Input/Output and is a part... used for writes byte to output stream. It implements a buffered output
triangle output
triangle output  program to get the following output: * *   Hi Friend, Please specify the pattern properly.ADS_TO_REPLACE_1 Thanks
What is the output if....
What is the output if....  Here is my code. what is the output...;When we put 50 as a lower limit value, output comes: (adsbygoogle... violation. After the catch block When we put 150 as a lower limit value, output
What will be the Output?
What will be the Output?  int[] number = {5,3,6,10,1} int temp; for (int i=0; inumbers[j]) { temp=numbers[i]; numbers[i]=numbers[j] number[j]=temp
output of the program
output of the program  public static int sum(List list) { int sum = 0; for ( Iterator iter = list.iterator(); iter.hasNext(); ) { int i = ((Integer)iter.next()).intValue(); sum += i; } return sum
xml output
xml output  generate an xml output in the following format <FileCount> <DOC>AA <RTF>BB <PDF>CC <Total>DD where AA=total number of .DOC files found BB=total number of .RTF files found,etc
output error
output error  this is my program import java.io.*; public class separate { public static void main(String[] args)throws IOException...]; for (k=0;k } } if i enter "my name" as the input the output
what is the output?
what is the output?  public class MyAr{ public static void main(String argv[]) { int[] i=new int[5]; System.out.println(i[5]); } }   It gives ArrayIndexOutOfBoundsException as you haven't add element to array. Correct
what will the output
= (Parent) sonu; p.play(); What will be the output of above section of code
<c: out> For Simple Calculation and Output
<c: out> For Simple Calculation and Output          One of the general... is to display the output to the user. It works like expression tag in jsp <%= ---%>
jsp one to one mapping
jsp one to one mapping  how to perform one to one mapping in jsp....code of one to one mapping with .xml file
output java - Java Beginners
output java  public static int secret(int one) { int i; int prod= 1; for ( i=1;i<=3;i++) prod = prod*one; return prod; } a. what is the output of the ff. java statement:? i. System.out.println (secret
Hibernate one-to-one relationships
Hibernate one-to-one relationships  How does one to one relationship work in Hibernate?   Hibernate Mapping One-to-One Hibernate provides.... here is an example showing one to one relationship using hbm.xml. We have two
ModuleNotFoundError: No module named 'output'
ModuleNotFoundError: No module named 'output'  Hi, My Python... 'output' How to remove the ModuleNotFoundError: No module named 'output'... to install padas library. You can install output python with following command
what is given output?
what is given output?  public class { public static void main(string argv
Data input & output Stream
Data input & output Stream  Explain Data Input Stream and Data Output... stream in a machine-independent way. A data output stream lets an application write primitive Java data types to an output stream in a portable way
how to get following output
how to get following output  input 123456 output 1 2 3 4 5 6
how to get following output
how to get following output  input 123456 output 1 2 3 4 5 6
Output Encoding - JSP-Servlet
Output Encoding  From security vulnerability perspective, we?d like to perform output encoding of special characters (ex: < > ? ? % ; ( ) & +) on JSP while displaying pages.How can this be achieved ? Can we achieve
Input and Output package
Input and Output package  Hi guys, My professor used input and output... she used in.readint() out.writeln() commands to read input and print output. she created two new objects directly to use this statements. /* input and output
Object Output Stream
Object Output Stream  Can anyone decode the data from a file which is written by ObjectOutputStream?? I want to know if this is a secure way to write protected data without encryption
how to write code for this output?
how to write code for this output?   1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
output using SQL
output using SQL  how to get ( 15 march 2011) and (15/03/2011) output using SQL   Use the following queries to get the data from database in the given format. For (15 march 2011) format: SELECT DATE_FORMAT(dob, '%d
JPA One-to-One Relationship
JPA One-to-One Relationship   ... will learn  about the one-to-one relationship. In the one-to-one relation mapping a single value association to another entity.  One-to-One: In one-to-one
Output of null value
(str); } } Output value Null Description:- In the given example
Give a one to one example in Hibernate.
Give a one to one example in Hibernate.  Hello, Can you give me one to one example in Hibernate..Thanks....   Hello, TO read about One to one relationships in hibernate, you can go through the following links
Error output - JSP-Servlet
Error output  Can anyone please assist me; The printed output should be: The product is 10. But instead of it I got; The product is undefined. Can anyone trace what went wrong of my code pls
output error - JSP-Servlet
output error  /*hi friends, the given below is my servlet program error? How can i solve this problem? */ HTTP Status 500 - -------------------------------------------------------------------------------- type Exception
input output in java
input output in java  java program using filereader and filewriter   Hi Friend, Try the following code: import java.io.*; class FileInputStreamAndFileOutputStream { public static void main(String[] args) throws
Handling transformation output
Handling transformation output       Handling transformation output After passing xml and xsl sheets , we need to handle output ,after transformation
How to compile & get output for JSP
the said above one. So Kinly tell me the solution how to get the output...How to compile & get output for JSP  HI My Roseindia friend has given the answer as RUN the JSP How to run the JSP Program? But what i mean is that i
Creating custom output using XMLUnit - MatchTracker duplicates the output data
Creating custom output using XMLUnit - MatchTracker duplicates the output data  how to create a custom output using xmlunit, I have tried it and used... in input xml and I am having duplicate data in output
Output Previous or Next Day of the Month
Output Previous or Next Day of the Month   Please Help! I need... or previous day: The program should output the next day's or previous day's date... or previous day: next Tomorrow is the 8th. For the response of 'previous', one
How to get Output for a Bean problem
How to get Output for a Bean problem  Hello Kindly tell me a simple Program on Bean to get the Output using JSP code
ModuleNotFoundError: No module named 'colcon-output'
ModuleNotFoundError: No module named 'colcon-output'  Hi, My... 'colcon-output' How to remove the ModuleNotFoundError: No module named 'colcon-output' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'list_output'
ModuleNotFoundError: No module named 'list_output'  Hi, My Python... 'list_output' How to remove the ModuleNotFoundError: No module named 'list_output' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'matrix_output'
ModuleNotFoundError: No module named 'matrix_output'  Hi, My... 'matrix_output' How to remove the ModuleNotFoundError: No module named 'matrix_output' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Output_item'
ModuleNotFoundError: No module named 'Output_item'  Hi, My Python... 'Output_item' How to remove the ModuleNotFoundError: No module named 'Output_item' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'output_matrix'
ModuleNotFoundError: No module named 'output_matrix'  Hi, My... 'output_matrix' How to remove the ModuleNotFoundError: No module named 'output_matrix' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'output_package'
ModuleNotFoundError: No module named 'output_package'  Hi, My... named 'output_package' How to remove the ModuleNotFoundError: No module named 'output_package' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'PLP-Output'
ModuleNotFoundError: No module named 'PLP-Output'  Hi, My Python... 'PLP-Output' How to remove the ModuleNotFoundError: No module named 'PLP-Output' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'PLP-Output'
ModuleNotFoundError: No module named 'PLP-Output'  Hi, My Python... 'PLP-Output' How to remove the ModuleNotFoundError: No module named 'PLP-Output' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'quartet_output'
ModuleNotFoundError: No module named 'quartet_output'  Hi, My... named 'quartet_output' How to remove the ModuleNotFoundError: No module named 'quartet_output' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'tree_output'
ModuleNotFoundError: No module named 'tree_output'  Hi, My Python... 'tree_output' How to remove the ModuleNotFoundError: No module named 'tree_output' error? Thanks   Hi, In your python environment

Ads