Malleshwari
Output of this one
1 Answer(s)      3 years and a month ago
Posted in : Java Interview Questions


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 Pages:
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
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
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
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
Input And Output
Input And Output       Introduction The Java I/O means Java Input/Output and is a part of java.io... for writes byte to output stream. It implements a buffered output stream
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
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
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
<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 <%= ---%>
Hibernate One-to-one Relationships
Hibernate One-to-one Relationships       Hibernate One-to-one Relationships - One to one relationships example using xml meta-data This section we
counting the values in input file and and writing the output to a file
counting the values in input file and and writing the output to a file  Can any one please correct this code. This is to read a file and later it should write the output to a file. Input file has 20 rows and 4 columns. If we
How to get the output of jsp program using Bean
already did that one. Now i want the output of the program ,so please tell me...How to get the output of jsp program using Bean  Hello my Roseindia netizen has suggested one program but when i implement the same i am not getting
How to get the output of JSP program using Bean
How to get the output of JSP program using Bean  Hi Kindly go through a simple program below and give the solution for the said below one...; } public void setCoun(int coun) { this.coun = coun; } } The above one i
Servlet signup same output - JSP-Servlet
Servlet signup same output  Ok i solved the problem of content type by res.setContentType("text/plain"), but the output is same it always prints the else value(i.e. One of the mandatary field is empty) so please help, thanks
QUE 50 ...please show output also...
QUE 50 ...please show output also...  Q1. Write a program to find... a program that sorts the elements stored in a one dimensional array Q18... 2 non-abstract sub-classes called Circle and Rectangle. Circle has one
Console Output
can write one complete output line to the console by calling... Java NotesConsole Output You can write programs that write text lines... for simple input/output, use dialog boxes (see Dialog Box Output). 1 2 3
jsp code for display of data from database and snap shot of the output
in which i have entered these data.plz some one help me..i m going to submit my project next week..i want to se the snapshots of the output   Please visit
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
Hibernate Many-to-one Relationships
Hibernate Many-to-one Relationships       Hibernate Many-to-one Relationships - Many to one relationships example using xml meta-data This current
triangle output
triangle output  program to get the following output: * *   Hi Friend, Please specify the pattern properly. Thanks
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
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: Entering... as a lower limit value, output comes: Entering the try block. Exiting the try block
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
JPA One-to-Many Relationship
JPA One-to-Many Relationship     ... the one-to-many relationship and how to develop a one-to-many relation in your JPA Application. One-to-Many: In this relationship each record in Table-A may have
JPA Many-to-one Relationship
JPA Many-to-one Relationship   ... about the many-to-one relationship and how to develop a many-to-one relation in your JPA Application. Many-to-One: In this relationship many related records
Copy one file into another
Copy one file into another In this section, you will learn how to copy content of one file into another file. We will perform this operation by using...;This string is copied from one file to another\n"); bf.close(); InputStream
Hibernate One-to-many Relationships
Hibernate One-to-many Relationships       Hibernate One-to-many Relationships - One to many example code in Hibernate using the xml file as metadata. Here
Java: Debugging Output
Java: Debugging Output System.out.println The System.out.println is used to debug a java program. Here is one example code: class HelloWorld { public static void main(String[] args) { System.out.println("Hello
JLabel for output
Java: JLabel for output Why using JLabel for output is usually bad... idea after the user interface is already displayed. For output JTextField is often a better choice. The use of JLabel for output is mentioned because some
Dialog Box Output
You can write one complete output line to the console by calling... Prev: Do Nothing | Next: Dialog Box Input-Output Java NotesDialog Box Output...;); } } Line 6 - import One strength of Java is that it has many
Java - Copying one file to another
Java - Copying one file to another   ... how to copy contents from one file to another file. This topic is related to the I/O (input/output) of java.io package. In this example we are using File class
Dialog and Console Input-Output
Prev: Dialog Box Output | Next: Example: Captitalize Java NotesDialog..., Earthling?"); name = in.nextLine(); // Read one line from... output System.out.println("Take me to your leader, " + name
What is the equivalent method in Java which is equivalent to clrscr() in c/c++ . The code should help to clear the output screen ?
++ . The code should help to clear the output screen ?  Hello to all, I... here); But this doesn't worked for me, Can any one help to find answer... Thanks to every one
Convert One Unit to Another
Convert One Unit to Another       Again in this section, you will learn to convert One Unit to Another...:" + gram);   } } Output
one attribute of type int - Java Beginners
one attribute of type int  hi friends can anyone help me understand this question:- Define a class called Month. Your class will have one... the month as the first 3 letters in the name of the month, f) an output function
Counting the highest sequence of zeros and one's - Java Beginners
Counting the highest sequence of zeros and one's  Count the highest sequence value of '0's and '1's. for a given string with zeroes and ones.... Output: It should contain the maximum sequence count of zeros and ones
how to pass a string from one class to another
how to pass a string from one class to another  hi all, Good morning. I am trying to develop a coding pass a string from one class and declare...()); // class1.class1Method(); } } // i want to display the output of 1.txt
Copy One Database Table to Another
Copy One Database Table to Another       In this section, you will learn to copy one database table to another database table. That means we copy one table to a different table
Java - Copying one file to another
Java - Copying one file to another       This example illustrates how to copy contents from one file to another file. This topic is related to the I/O (input/output
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.