The boys, aged 14 and 17, were before the Dublin Children’s Court and have been remanded on bail by Judge John O’Connor.
Neither have previous criminal convictions and the judge asked for probation reports.
He said it must have been very frightening for the shop workers and the public.
The court heard that the younger boy had aimed a black imitation firearm at two members of staff during the incidents, which occurred in Dublin city’s northside last October.
He pleaded guilty to charges of robbery and possessing a firearm.
The pair were chased out of one store but went to another where the balaclava-wearing 14-year-old boy “pointed the gun at the shop assistant” before his accomplice entered and “grabbed a box of sweets”, said Garda Brian Graydon.
Defence solicitor Gareth Noble said that it had been a game taken to “extreme lengths” and the boy, who was accompanied to court by his mother, was apologetic.
He said that the boy did not realise the implications of his actions and disposed of the imitation gun by throwing it on a Halloween bonfire.
The 17-year-old, who pleaded guilty to robbery and attempted robbery, was accompanied by his mother. His solicitor David Stafford told Judge O’Connor that the youth was apologetic and had been mixing with “an undesirable crowed” at the time of the offence.
Adjourning the case to September, Judge O’Connor said that the pair acted in “common design” and the offence was “very serious”, even if the gun was not real.