2

I don't have prior knowledge in coding. But would like to know and learn more about Salesforce Development and coding in Apex.

I heard that Apex is more or like Java script, Is it true? Whether a new person without prior knowledge can learn the Apex coding or need to know Java scripting first? Is Apex the only coding language for Salesforce?

Thanks, Robert

1 Answer 1

5

Apex is more similar to Java then javascript. Take a look at the docs here, What is Apex:

Apex is a strongly typed, object-oriented programming language that allows developers to execute flow and transaction control statements on the Force.com platform server in conjunction with calls to the Force.com​ API. Using syntax that looks like Java and acts like database stored procedures, Apex enables developers to add business logic to most system events, including button clicks, related record updates, and Visualforce pages. Apex code can be initiated by Web service requests and from triggers on objects.

This doc here points out the major differences between apex and java.

Differences Between Apex Classes and Java Classes

  • The following is a list of the major differences between Apex classes and Java classes:

  • Inner classes and interfaces can only be declared one level deep inside an outer class.

  • Static methods and variables can only be declared in a top-level class definition, not in an inner class.

  • An inner class behaves like a static Java inner class, but doesn’t require the static keyword. An inner class can have instance member variables like an outer class, but there is no implicit pointer to an instance of the outer class (using the this keyword).

  • The private access modifier is the default, and means that the method or variable is accessible only within the Apex class in which it is defined. If you do not specify an access modifier, the method or variable is private.

  • Specifying no access modifier for a method or variable and the private access modifier are synonymous.

  • The public access modifier means the method or variable can be used by any Apex in this application or namespace.

  • The global access modifier means the method or variable can be used by any Apex code that has access to the class, not just the Apex code in the same application. This access modifier should be used for any method that needs to be referenced outside of the application, either in the SOAP API or by other Apex code. If you declare a method or variable as global, you must also declare the class that contains it as global.

  • Methods and classes are final by default.

  • The virtual definition modifier allows extension and overrides.

  • The override keyword must be used explicitly on methods that override base class methods.

  • Interface methods have no modifiers—they are always global.

  • Exception classes must extend either exception or another user-defined exception.

  • Their names must end with the word exception.

  • Exception classes have four implicit constructors that are built-in, although you can add others.

  • Classes and interfaces can be defined in triggers and anonymous blocks, but only as local.

A great getting started guide recommends reading the Head First Java book.

I believe you can learn Apex without learning Java but it depends on your learning style and your background.

1
  • 1
    That was so detailed and thanks a lot for helping me. I have already ordered for Head First Jav book as well. Commented Apr 18, 2016 at 0:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .