Jump to content

Recommended Posts

Posted
 

 

6wItAcC.png

 

 

Java Data and Variables

 

There are 8 primitive data types. he 8 primitive data types are numeric types. The names of the eight primitive data types are:

 

byte short int long float double char boolean

There are both integer and floating point primitive types. Integer types have no fractional part; floating point types have a fractional part. On paper, integers have no decimal point, and floating point types do. But in main memory, there are no decimal points: even floating point values are represented with bit patterns. There is a fundamental difference between the method used to represent integers and the method used to represent floating point numbers. 

 

 

7wxrbU8.png

 

 


Examples

 

int yr = 2006;

double rats = 8912 ;

 

         For each primitive type, there is a corresponding wrapper class. A wrapper class can be used to convert a primitive data value into an object, and some type of objects into primitive data. The table shows primitive types and their wrapper classes:

 

 

qtZkbI7.png

 

 

Variables only exist within the structure in which they are defined. For example, if a variable is created within a method, it cannot be accessed outside the method. In addition, a different method can create a variable of the same name which will not conflict with the other variable. A java variable can be thought of as a little box made up of one or more bytes that can hold a value of a particular data type:

 

Syntax: variabletype variablename = data;

 

Source Code ( demonstrating declaration of a variable )



class example
{
  public static void main ( String[] args )
  {
    long x = 123;    //a declaration of a variable named x with a datatype of long


    System.out.println("The variable x has: " + x );
  }
}



Source Code



public class MaxDemo {
     public static void main(String args[]) {
     //integers
          byte largestByte = Byte.MAX_VALUE;
          short largestShort = Short.MAX_VALUE;
          int largestInteger = Integer.MAX_VALUE;
          long largestLong = Long.MAX_VALUE;




         //real numbers
         float largestFloat = Float.MAX_VALUE;
         double largestDouble = Double.MAX_VALUE;



       //other primitive types
        char aChar = 'S';
        boolean aBoolean = true;



        //Display them all.
        System.out.println("largest byte value is " + largestByte + ".");
        System.out.println("largest short value is " + largestShort + ".");
        System.out.println("largest integer value is " + largestInteger + ".");
        System.out.println("largest long value is " + largestLong + ".");
        System.out.println("largest float value is " + largestFloat + ".");
        System.out.println("largest double value is " + largestDouble + ".");
   }
}



 


Sample Run

 

The largest byte value is 127.

The largest short value is 32767.

The largest integer value is 2147483647.

The largest long value is 9223372036854775807.

The largest float value is 3.4028235E38.

The largest double value is 1.7976931348623157E308.

 

 

Dear Baggos mentioned on my previous post that a guide related to variables would be nice so here it is :)

Thanks.

 

  • Upvote 1
Posted (edited)

vampir only said than

if (condition)
{
  _var = 1;
}
else
{
   _var = 2;
}

could be replaced by

if (condition)
   _var = 1;
else
   _var = 2;

and even more sexier by

_var = (condition) ? 1 : 2;
Edited by Tryskell
Posted

 

vampir only said than

if (condition)
{
  _var = 1;
}
else
{
   _var = 2;
}

could be replaced by

if (condition)
   _var = 1;
else
   _var = 2;

and even more sexier by

_var = (condition) ? 1 : 2;

 

I like the way you think XD

Posted (edited)

I like the way you think XD

 

See a real case scenario of "if/else if" shortcuted here (fighter / mage buffs) : 

 

http://www.maxcheaters.com/topic/211475-newbies-helper-npc-acis/?p=2611476

 

As you can see, that idiom

(check) ? trueStatement : falseStatement

 can reduce redundant code for the same output.

Edited by Tryskell
Posted (edited)

See a real case scenario of "if/else if" shortcuted here (fighter / mage buffs) : 

 

http://www.maxcheaters.com/topic/211475-newbies-helper-npc-acis/?p=2611476

 

As you can see, that idiom

(check) ? trueStatement : falseStatement

 can reduce redundant code for the same output.

 

Yea i have alot to improve thanks for showing me the way :) thats a way to shorten the code also make the code easier to read and understand.

Edited by Sawadee
Posted

http://www.freejavaguide.com/java_variables.htm

 

Im dying laughing over here.

 

Nice u diged internet to find what i shared, but i didnt even know that this guide was posted on somewhere as i mentioned before i just copy and paste this guide from a pdf file that i found in my pc thats simple theres no need to tryhard :) The difference between me and you, you just break balls and do actually nothing for this community and i try to help with anythin/whatever i have/can.

Posted

Nice u diged internet to find what i shared, but i didnt even know that this guide was posted on somewhere as i mentioned before i just copy and paste this guide from a pdf file that i found in my pc thats simple theres no need to tryhard :) The difference between me and you, you just break balls and do actually nothing for this community and i try to help with anythin/whatever i have/can.

Exquse me but you just got pwned. http://www.maxcheaters.com/topic/203773-free-help-small-code-fixes-request-small-codes/

Also continue this "speech". Next time you're reported for share guides without credits and bad language toward members. 

Posted (edited)

Exquse me but you just got pwned. http://www.maxcheaters.com/topic/203773-free-help-small-code-fixes-request-small-codes/

Also continue this "speech". Next time you're reported for share guides without credits and bad language toward members. 

 

Bad language toward members? u should be banned for trolling and spammin on other people guides all the time i already reported you 3 times and im goin to do it again lets see who will be banned. stop acting like a lawyer u are just a simple member here mind your own business if anything is wrong with me ill be punished if anything is wrong with you, you will be punished just for gods sake stop posting on other topics and judge the people like your are their boss.

Edited by Sawadee
Posted

Bad language toward members? u should be banned for trolling and spammin on other people guides all the time i already reported you 3 times and im goin to do it again lets see who will be banned. stop acting like a lawyer u are just a simple member here mind your own business if anything is wrong with me ill be punished if anything is wrong with you, you will be punished just for gods sake stop posting on other topics and judge the people like your are their boss.

You can't report someone who just tell you that you sharing tutorials without adding credits and going against rules. What you gonna report me for? 

"This user flame my topic and force me to put credits on stolen tutorials?" 

 

I don't flame, i just say you go against rules and leech other's tutorials. You dont want understand it? Report me as many times you want but read rules and we see who is wrong and who is right.

Posted

You can't report someone who just tell you that you sharing tutorials without adding credits and going against rules. What you gonna report me for? 

"This user flame my topic and force me to put credits on stolen tutorials?" 

 

I don't flame, i just say you go against rules and leech other's tutorials. You dont want understand it? Report me as many times you want but read rules and we see who is wrong and who is right.

 

I didnt even read anything ill be honest, lets see what will be the action of admin/moderators about us.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Opening December 6th at 19:00 (GMT +3)! Open Beta Test from November 30th!   https://l2soe.com/   🌟 Introducing L2 Saga of Eternia: A Revolution in Lineage 2 High Five! 🌟   Dear Lineage 2 enthusiasts, Prepare to witness the future of private servers! L2 Saga of Eternia is not just another High Five project—it’s a game-changing experience designed to compete with the giants of the Lineage 2 private server scene. Built for the community, by the community, we’re here to raise the bar in quality, innovation, and longevity. What Sets Us Apart? 💎 No Wipes, Ever Say goodbye to the fear of losing your progress. Our server is built to last and will never close. Stability and consistency are our promises to you. ⚔️ Weekly New Content Our dedicated development team ensures fresh challenges, events, and updates every week. From custom quests to exclusive features, there will always be something exciting to explore. 💰 No Pay-to-Win Skill and strategy matter most here. Enjoy a balanced gameplay environment where your achievements come from effort, not your wallet. 🌍 A Massive Community With 2000+ players expected, join a vibrant and active community of like-minded adventurers ready to conquer the world of Aden. 🏆 Fair and Competitive Gameplay Our systems are designed to promote healthy competition while avoiding abusive mechanics and exploits. 🔧 Professional Development From advanced bug fixes to carefully curated content, we pride ourselves on smooth performance, no lag, and unparalleled server quality. Key Features Chronicle: High Five with unique interface Rate: Dynamic x10 rates Class Balance: Carefully fine-tuned for a fair experience PvP Focused: PvP Ranking & aura display effect for 3 Top PvPers every week Custom Events: Seasonal and permanent events to keep you engaged Additional Features:   Custom Endgame Content: Introduce unique dungeons, raids, or zones unavailable in other servers. Player-Driven Economy: Implement a strong market system and avoid overinflated drops or rewards. Epic Siege Battles: Announce special large-scale sieges and PvP events. Incentives for Streamers and Clans: Attract influencers and big clans to boost server publicity. Roadmap Transparency: Share a public roadmap of planned updates to build trust and excitemen   Here you can read all the features: https://l2soe.com/features   Video preview: Join the Revolution! This is your chance to be part of something legendary. L2 Saga of Eternia is not just a server; it’s a movement to redefine what Lineage 2 can be. Whether you’re a seasoned veteran or a newcomer to the world of Aden, we invite you to experience Lineage 2 at its finest.   Official Launch Date: December 6th 2024 Website: https://l2soe.com/ Facebook: https://www.facebook.com/l2soe Discord: https://discord.com/invite/l2eternia   Let’s build the ultimate Lineage 2 experience together. See you in-game! 🎮
    • That's like a tutorial on how to run l2 on MacOS Xd but good job for the investigation. 
    • small update: dc robe set sold   wts adena 1kk = 1.5$ 
    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/hood-services https://campsite.bio/utchihaamkt
    • Why adena in this sever so expensive 🙂
  • Topics

×
×
  • Create New...