Following code is not working. The error message is "Compile Error: Initial term of field expression must be a concrete SObject: LIST at line 8 column 16" (return line is line 8)
public String getX(){
List<Oppoinvoice__c> o = [SELECT Opportunity__r.Account.Name FROM Oppoinvoice__c];
return o.Opportunity__r.Account.Name;
}