This is not as much of a newbie question as you might think. dainichi gave a good general rule-of-thumb, but at the risk of confusing you, I'd like to point out that there are many cases when を
and が
are actually interchangeable. For example, the sentence "I can play the piano" can be written either
ピアノが弾【ひ】ける
piano ga hikeru
or
ピアノを弾【ひ】ける
piano wo hikeru
A psychology professor from Ritsumeikan University in Kyoto conducted a study on the interchangeability of を
and が
in 2006. Although the paper he wrote is mostly in Japanese, there is a good summary in English at the beginning. He found that when presented with the sentence
ピアノ __ 弾【ひ】ける
piano __ hikeru
college students were split almost 50/50 on filling in the blank with を
vs. が
, while older people more strongly favored が
.
The main point the author makes is that in sentences where the predicate is an action, e.g.
ほしがる
hoshigaru
to want (or as dainichi more aptly put it, to act like you want)
the use of を
is overwhelmingly favored over が
; while in sentences where the predicate describes a state, を
and が
are either interchangeable, like with
弾【ひ】ける
hikeru
to be able to play (an instrument)
or が
is strongly favored, like with
好【す】き
suki
to like
The author also points out that context is important. Even though を
and が
are more or less interchangeable in the sentence
ピアノ __ 弾【ひ】ける
を
was heavily favored in the sentence
練習【れんしゅう】して,彼【かれ】はピアノ __ 弾【ひ】けるようにした
renshuu shite, kare ha piano __ hikeru you ni shita
He practiced and tried to become able to play the piano. (awkward translation but you get the gist)
However, even with this sentence, roughly one-third of the older respondents chose が
, so you're unlikely to go wrong if you always select が
when the predicate describes a state rather than an action.
This is just a slightly more nuanced version of the rule that dainichi gave. I simply wanted to point out that most rules have exceptions, and in the case of を
versus が
, even native speakers do not always reach a consensus.