Tech Students World
Subscribe
Subscribe to get the update Newsletters. This site is updated daily. Don't miss to check what's added.
                 Technology of the Week: iPod Basics *  Help of the Week: Blu-ray Technology
Skip Navigation Links
ContactUs
StudentsLibraryExpand StudentsLibrary
ExplanationOfTechnologiesExpand ExplanationOfTechnologies
TechEducationExpand TechEducation
TechTipsExpand TechTips
UsefulStudent ResourcesExpand UsefulStudent Resources
TodaySpecialsExpand TodaySpecials
WeekSpecialsExpand WeekSpecials
                                                    
Free Downloads Skip Navigation LinksHome > Java Certification Questions-Notes > Variables-Datatypes in Java
Skip Navigation Links
Home
Buying ComputersExpand Buying Computers
CertificationsExpand Certifications
Computer BasicsExpand Computer Basics
Computer DevicesExpand Computer Devices
Computer MaintenanceExpand Computer Maintenance
Computer SettingsExpand Computer Settings
Operating SystemsExpand Operating Systems
ProcessorsExpand Processors
Using MS-WindowsExpand Using MS-Windows
Internet BasicsExpand Internet Basics
Internet ServicesExpand Internet Services
Software AttacksExpand Software Attacks
Useful Links
New Student Resources
. Student Employment
. Cover Letter
. Applying for Graduate Assistantships
. SCJP Preparation
. Applying for US Universities

Variables and Data Types in Java

                                         
Note: Here,
SOP = System.out.println("");
psvm()=public static void main(String args[])

No. Java Question Answer/Output Explanation
1 final int x=10;
byte y;
SOP(y=x);
No Error -
2 byte a=10;
char ch=a;
Compile Time Error -
3 final int x=10;
char c=x;
No Error -
4 final int x=10;
byte a=10;
short j=a=x;
No Error -
5 SOP(~0 = = -1); True -
6 int a-class; Compile Time Error Invalid name(identifier) for a variable.
7 char ch = '\ucafe'; No Error -
8 char ch = '\u10100'; Compile Time Error -
9 char ch = (char) true; Compile Time Error -
10 char ch = "a"; Compile Time Error -
11 char ch = 'cafe'; Compile Time Error -
12 int a = 078; Compile Time Error Integers are assigned by octal values here. So, 8 is illegal digit for an octal value.
13 int m l; Compile Time Error -
14 int a = b;
int b = 4;
Compile Time Error Because of Forward Referencing.
15 public class some {
char ch = '\u000A';
}
Compile Time Error Because of illegal character assignment
16 public class some {
char ch = 'u000A';
}
Compile Time Error Complains about an invalid expression.
17 int x = 0; No Error -
18 int x = -5; No Error -
19 int x = 0423; No Error -
20 int x = 0xabcdef; No Error -
21 char ch = '\ucafe';
SOP(ch);
? -
22 char a = 0xa0a;
SOP(a);
? -
23 char a = 012; new line -
24 char a = 'a0a'; Compile Time Error Unclosed character literal
25 char a = '\377'; new line -
26 char a = '\777'; Compile Time Error Unclosed character literal
27 char f = '\ua0a'; Compile Time Error Illegal unicode escape
Skip Navigation Links.     
What's New
. Blu-ray
. iPod Basics
. Doing Java Project
. Symmetric MP
. Digital Cameras
. Virus,Spyware
. Sound to WebPage
. Wi-Fi
Popular Articles
. UNIX Commands
. Software Attacks
.
Adding RAM
. US Universities
. Free Java Tutorial
. Student Jobs
. Learn Spanish
. Java Notes
Let The World Know How Knowledgeable You Are
By sharing Your Knowledge With Others
If you would like to share your knowledge relating to Technology, you can send it to us at dailyquestion@techstudentsworld.com. If it is good, it will be published in this site along with your name or picture.
                  Copyright © 2008, Techstudentsworld.com. All Rights Reserved.