Basics of Apex Programming

Basics of Apex Programming

In this blog post, we will cover some basics related to apex programming. We will learn about datatypes, Variables and constants.

What is Apex class?

A class is a template or blueprint from which objects are created. An object is an instance of a class.
Let’s talk in detail about this class. Think of a class as a blueprint/design for a house, in the blueprint you define your bedrooms, bathrooms, layout of the house but nothing have been constructed yet. +Similarly Class is just a blueprint and just like you use the blueprint to construct houses, similarly we use class to create objects. Every class has three parts: Attributes, Methods and Constructors.

How to create a class in Apex?

[sourcecode lang=”Java”]

public class Employee
{
//define attributes
//define methods
//define constructors

}

[/sourcecode]

Data Types and Variables:

Variables are typically used to store information. Every variable has a data type which tells us about the type of data we will store in the variable.
Below is the list of data types in Apex:

Primitive data types (Integer,String, Boolean,…etc)
Enum (an enumerated list)
sObjects (sObject, like Account, contact, opportunity or custom object)

Learn more about datatypes here

In order to use a variable in salesforce, we have to first declare the variable.

How to declare a variable in salesforce?

 

[sourcecode lang=”Java”]
Integer a; //declaring the variable and its type
a=25; //intializing the variable with value of 25

[/sourcecode]

You can declare and initialize the variable in the same line as shown below:

[sourcecode lang=”Java”] integer a=25;[/sourcecode]

This Post Has 62 Comments

  1. Summer Austen

    Hello! Nice stuff, please do inform us when you post something like that!

  2. Ricki Susor

    Solid post! I honestly wasn’t aware of this. It is a relief to read because I get so disappointed when writers put no thought into their work. It is obvious that you know what you’re writing about. I’ll definitely visit again!

  3. Lucy

    Good article. I’m dealing with some of these issues as
    well..

  4. Very nice post. I just stumbled upon your blog and
    wanted to say that I have truly loved browsing your weblog posts.
    After all I’ll be subscribing in your rss feed and I am hoping you write
    once more soon!

  5. layarkaca21 lk21

    Article writing is also a excitement, if you be familiar with afterward
    you can write or else it is complicated to
    write.

  6. Hi! I could have sworn I’ve been to this web site
    before but after browsing through many of the posts I realized it’s new to me.

    Anyhow, I’m definitely delighted I came across it and I’ll be
    book-marking it and checking back regularly!

  7. Hello this is kinda of off topic but I was wondering if blogs use WYSIWYG editors or
    if you have to manually code with HTML. I’m starting a blog soon but have no coding know-how so I wanted to get advice from someone with
    experience. Any help would be enormously appreciated!

  8. Lenore

    Incredible! This blog looks exactly like my old one!
    It’s on a entirely different subject but it has pretty much
    the same page layout and design. Excellent choice of colors!

  9. layarkaca21 lk21

    Hey there! I know this is somewhat off topic but I
    was wondering which blog platform are you using for
    this website? I’m getting sick and tired of WordPress because I’ve had problems with hackers and I’m
    looking at options for another platform.
    I would be awesome if you could point me in the direction of a good platform.

  10. Her introduction too video games, Donkey Kong on the
    ColecoVision, came when she was thre years old.

  11. Gabriella

    My spouse and I stumbled over here by a different web page
    and thought I might check things out. I like what I see so now i am following you.
    Look forward to checking out your web page yet again.

  12. Alyssa

    Hey there just wanted to give you a quick heads up. The words
    in your article seem to be running off the screen in Internet explorer.
    I’m not sure if this is a format issue or something to do with internet browser
    compatibility but I thought I’d post to let you know.
    The layout look great though! Hope you get the issue resolved soon. Kudos

  13. layarkaca21 xxi

    Hello there, I think your blog could be having internet browser
    compatibility issues. Whenever I take a look at your website in Safari, it looks fine however,
    when opening in IE, it’s got some overlapping issues.

    I merely wanted to provide you with a quick heads up! Apart from that, excellent site!

  14. Right here is the perfect website for everyone who wishes to find out about this
    topic. You understand so much its almost tough to argue with
    you (not that I personally will need to…HaHa).
    You certainly put a brand new spin on a topic
    that has been discussed for many years. Excellent stuff, just great!

  15. Hello my family member! I wish to say that this article is awesome, great written and
    come with approximately all important infos. I’d like to peer extra posts like this .

  16. I have to thank you for the efforts you have put in penning this
    website. I’m hoping to view the same high-grade blog posts from you in the
    future as well. In fact, your creative writing abilities has
    inspired me to get my own website now 😉

  17. Michael

    Hey There. I found your blog the use of msn. That is an extremely well written article.
    I’ll be sure to bookmark it and come back to read extra
    of your helpful information. Thanks for the post.
    I’ll certainly comeback.

  18. Janis

    Hey this is kind of of off topic but I was wanting
    to know if blogs use WYSIWYG editors or if you have to manually
    code with HTML. I’m starting a blog soon but have no coding
    skills so I wanted to get advice from someone with experience.
    Any help would be enormously appreciated!

  19. I’m not that much of a internet reader to be honest but your blogs really nice, keep it up!

    I’ll go ahead and bookmark your website to come back later.
    Cheers

  20. Lester

    Thank you, I’ve just been searching for info about this subject for a long time and yours is the greatest I’ve
    came upon so far. However, what about the bottom line? Are you
    sure about the supply?

  21. Thomas

    Does your site have a contact page? I’m having problems locating it but,
    I’d like to shoot you an email. I’ve got some ideas for your blog you might be interested in hearing.
    Either way, great website and I look forward to seeing it develop over time.

  22. YouTube

    I truly love your website.. Pleasant colors & theme.
    Did you create this website yourself? Please reply back as I’m
    trying to create my own site and want to know where you got this from or what the theme is named.
    Appreciate it!

  23. Lillian

    The lack of most ordinary sports betting possibilities
    has offered rise to other wagering activity on sports betting platforms about the globe, some with questionable legality.

  24. layarkaca21 lk21

    It’s awesome designed for me to have a web page, which is beneficial in support of
    my know-how. thanks admin

  25. layarkaca21 xxi

    I visited various web sites but the audio quality for audio songs
    current at this website is actually marvelous.

  26. Numbers

    Hi there, I discovered your web site by the use of Google whilst searching for a similar subject, your site came up, it looks good.
    I have bookmarked it in my google bookmarks.
    Hello there, just turned into aware of your weblog
    through Google, and located that it’s truly informative.
    I am gonna watch out for brussels. I’ll appreciate if you happen to proceed this in future.
    A lot of other people might be benefited from your writing.
    Cheers!

  27. Katharina

    Some of the impetus for South Dakota has come from the loss of prospective sports betting income to other states.

  28. Dorie

    The Bengals chosen LSU quarterback Joe Burrow and DraftKings set his total passing yards at 3700.five during his rookie season.

  29. Bridgette

    Social gambling and the rising popularity of gambling applications are some of
    the largest indicators in this regard.

  30. Bruno

    Pennsylvania is at the moment one particular of the busiest regulated sports betting markets in the nation.

  31. Leopoldo

    Click for recommendations on how to include insured prizes in your subsequent campaign.

  32. Alejandro

    In January 2017, Pedro Grendene Bartelle won $3.5million playing French roulette at Hotel Conrad, Punta del Este, Uruguay.

  33. layarkaca21

    When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time
    a comment is added I get several e-mails with the
    same comment. Is there any way you can remove people from that
    service? Thanks a lot!

  34. Aw, this was an exceptionally good post. Spending some time and actual effort to make a
    really good article… but what can I say… I put
    things off a whole lot and don’t seem to get nearly anything done.

  35. Porter

    Yet, it can provide a neat way of discovering new bookmakers.

  36. Britney

    Sin City no longer has the legal sports betting market on lockdown.

  37. layarkaca21

    This post is invaluable. Where can I find out more?

  38. Audra

    The odds for favorites are accompanied by a minus (-) sign, indicating the amount you
    have to have to stake to win $one hundred.

  39. YouTube

    Howdy! Would you mind if I share your blog with my
    myspace group? There’s a lot of people that I think would really appreciate your content.
    Please let me know. Cheers

  40. Domingo

    We’re the home of odds comparison at legal on the net sportsbooks in the USA.

  41. Lena

    Have I produced my intentions clear to their parents as
    to what sport is about in this organization?

  42. Franklyn

    Premium European Roulette wheels have a number range of to 36, therefore
    influencing probability.

  43. Lowell

    Lee is an IT Consultant and seemed to take pleasure in the game properly,
    from his writing and dedication to the long run of the game.

  44. Francisca

    That indicates New Jersey is taking in 17.five% on that total revenue just
    about every year, or roughly $70 million in tax income a year.

  45. Alonzo

    The fundamental betting lines for most bets are a point spread, total, and moneyline.

  46. Lavon

    We want to show you the most effective tennis betting bonuses provided by the operators in your country.

  47. Danny

    Speaking and writing abilities also are crucial for this profession.

  48. Flora

    Also, individuals that sign up to participate in PlayPause can also
    volunteer to have their appearance on the program to then spread to other states as they open up to the tool.

  49. Good site you’ve got here.. It’s difficult
    to find good quality writing like yours nowadays.
    I honestly appreciate individuals like you! Take care!!

  50. Johnette

    Legal mobile sports betting apps use geolocation technologies to ascertain a user’s location at the
    time of use.

  51. Angela

    On the other hand, the depositing list incorporates Sofort, Skrill (and
    1-Tap), Neteller, Zimpler, Euteller, EPS, paysafecard, and Entropay.

  52. Freeman

    Of course, Mr. Ogden – recognized as the “Godfather of
    gambling” – sparked a surge in the reputation of betting on horses.

  53. Zulma

    Your style is unique compared to other folks I’ve read
    stuff from. Thanks for posting when you have the opportunity,
    Guess I will just bookmark this site.

  54. Grady

    Ahaa, its pleasant discussion regarding this article here at this web site, I
    have read all that, so now me also commenting at this place.

  55. Roberto

    I visited many web sites however the audio quality for audio songs present at this site is truly wonderful.

  56. Lonny

    This blog was… how do you say it? Relevant!! Finally I’ve found something which helped me.
    Kudos!

  57. Raul

    WOW just what I was looking for. Came here by searching for website

  58. Carson

    This is a great tip especially to those fresh to the blogosphere.
    Brief but very accurate information… Thanks for sharing this one.
    A must read article!

  59. Tamera

    Sweet blog! I found it while browsing on Yahoo News.
    Do you have any tips on how to get listed in Yahoo News?

    I’ve been trying for a while but I never seem to get
    there! Thanks

  60. Federico

    Its like you read my mind! You seem to know so much about
    this, like you wrote the book in it or something.

    I think that you could do with a few pics to drive the message home
    a little bit, but other than that, this is fantastic blog.
    A fantastic read. I’ll definitely be back.

Leave a Reply