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
manjunath vivekmanjunath vivek 

couple of doubts on controller

<apex:page Controller="Delet">

<apex:form >

  <center>
  <apex:pageBlock >
    <b>Category:&nbsp;&nbsp;</b>
    <apex:selectList value="{!ctgry}" size="1">
      <apex:selectOptions value="{!ctgrys}"/>
    </apex:selectList> 
  </apex:pageBlock>
  </center>
 
</apex:form>
</apex:page>





public class Delet
{

    public String[] ctgry = new String[]{};
   
    public Delet()
    {

    }
   
    public List<SelectOption> getCtgrys()
    {   
      List<SelectOption> options = new List<SelectOption>();
      options.add(new SelectOption('US','US'));
      options.add(new SelectOption('CANADA','Canada'));
      options.add(new SelectOption('MEXICO','Mexico'));
      return options;
    }
   
    public String[] getCtgry()
    {
      return ctgry;
    }
   
    public void setCtgry(String[] ctgry)
    {
    this.ctgry = ctgry;
    }   

}



Can some one tell me in the above code,what is &nbsp;&nbsp and in the line public String[] ctgry = new String[]{};
why [] and {} both the braces is used and what does that line mean.
why  MEXICO','Mexico' caps and small letters used.why constructor,getter and setter used.
Ravikant Saini 1Ravikant Saini 1
Hi manjunath,
     String[] ctgry = new String[]{}  is use for string type list.
      new String[]{'MEXICO','Mexico'}.
getCtgrys() is for get value on page from controller.
and setCtgry() is for set value to controller to page.
manjunath vivekmanjunath vivek
You have any idea what is &nbsp;&nbsp and why  MEXICO','Mexico' caps and small letters used.
pankaj kabra 8pankaj kabra 8
&nbsp;&nbsp is used for providing two spaces and MEXICO capital is for display and Mexico will get stores in database.