function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tanuja JTanuja J 

A query from force.com developer guide

Hi,
I am newbie learning Apex.
I have  gone through the Force.com developer guide.
Could you please explin me 
public static void applyDiscount(Book__c[] books)  what this means?
I have understood everything in that sentence exept bracket part(Book__c[] books)
I just want to know the meaning of book__c[] books.
Abhishek BansalAbhishek Bansal
This means that you are passing a list of Book__c in your method.
Abhishek BansalAbhishek Bansal
Please consider the beloe example for more clarification :
 
Public class DemoClass
{
	public Demo(){
		List<Book__c> bookList = new List<Book__c>([Select id,Discount__c from Book__c]);
		applyDiscount(bookList);
	}
	public static void applyDiscount(Book__c[] books){
		//Now you have list of book in books variable and you can use it to perform your action.
	}
}
Let me know if you need more help.

Regards,
Abhishek