Need Help with Java Index -> Programming, Java -> Java Help
AuthorMessage
CyCLoBoT Posted: Sat Sep 20, 2003 12:39 am Post subject: Need Help with Java
I need help with the following questions. Any help would be really appreciated.

You are watching: Write a hexadecimal integer literal representing the value fifteen

1) Write a literal representing the long integer value twelve billion.2) Write a hexadecimal integer literal representing the value fifteen.
Sponsor
Sponsor
*
*
rizzix
Posted: Sat Sep 20, 2003 4:32 pm Post subject: (No subject)
1) 12000000000L2) 0xf
krishon
Posted: Mon Sep 22, 2003 7:42 am Post subject: (No subject)
................whoa wuts goin on, lol
rizzix Posted: Mon Sep 22, 2003 8:43 am Post subject: (No subject)
First a literal is something like "hello world", 120.. etcsome thing that can be written and not necessarly represented by variables only.As a matter of fact all primitives in their written form are literals. You can"t really have an object as a literal. but in java"s case a String (like "Hello World") would be the an object that is a literal.here are a couple of literals:int: 12long: 12Lfloat:12.0Fdouble: 12.0String: "Hello World"char: "A"boolean: trueboolean: falseas you can see 12 and 12L are two different things. 12 allocates enough space for an int variable to hold it, while 12L allocates enough space for a long variable to hold it. when the numbers are far too big like 12000000000000 etc.. that num won"t fit in a int variable, thus this is a syntax error: code:

int bignum = 1200000000000;
take a look at this:
code:

long bignum = 12;
you might have noticed i assigned a int literal to a variable of type long! Shouldn"t that give a syntax error? No. Here Java"s promotion scheme comes into play. If the variable type is greater than that of the value it is being assgined, that value is automatically promoted to the greater type. in this case 12 is converted to 12L. Another time this type of "promotion" takes place is when adding multiplying etc.. then everthing gets promoted to the greatest type possible.but this is a syntax error:
code:

since 1200000000000 is an int literal (but too big) .

See more: 7 Days To Die Vault Hatch - Hatch Upgrade Blocked In A18

rizzix
Posted: Mon Sep 22, 2003 8:52 am Post subject: (No subject)
F or f (case does not matter) is hexadecimal for 15.in java to denote a hexadecimal (base 16) number you prefix it with 0xand to denote a octal (base 8) number you prefix it with a 0so these are identical: code:

krishon
Posted: Mon Sep 22, 2003 4:56 pm Post subject: (No subject)
ahhhh.ok i c
Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 YearOldest FirstNewest First
Index -> Programming, Java -> Java Help
*
Page 1 of 1 < 6 Posts >
Jump to:Select a forumthedailysplash.tv------------- Network News- General DiscussionGeneral Forums------------------ Hello World- Featured Poll- ContestsContest Forums------------------ DWITE- Contest 2006/2008- 2005/2006 Archive- 2004/2005 Archive- Off TopicLounges---------- User Lounge- VIP LoungeProgramming--------------- General ProgrammingGeneral Programming Forums--------------------------------- Functional Programming- Logical Programming - CC--- C Help- C Tutorials- C Submissions- C++C++----- C++ Help- C++ Tutorials- C++ Submissions- JavaJava------ Java Help- Java Tutorials- Java Submissions- RubyRuby------ Ruby Help- Ruby Tutorials- Ruby Submissions- TuringTuring--------- Turing Help- Turing Tutorials- Turing Submissions- PHPPHP----- PHP Help- PHP Tutorials- PHP Submissions- PythonPython--------- Python Help- Python Tutorials- Python Submissions- Visual Basic and Other BasicsVB---- Visual Basic Help- Visual Basic Tutorials- Visual Basic SubmissionsEducation------------ Student LifeGraphics and Design------------------------ Web DesignWeb Design Forums---------------------- (X)HTML Help- (X)HTML Tutorials- Flash MX Help- Flash MX Tutorials- GraphicsGraphics Forums------------------- Photoshop Tutorials- The Showroom- 2D Graphics- 3D GraphicsTeams------- dTeam Public
Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search:

You can syndicate this boards posts using the file backend.php or view the topic map using sitemap.php.Terms of Use | Privacy Policy