package main
import "reflect"
type T struct{
A int
b int
}
func (T) M() {}
func (T) m() {}
func main() {
v := reflect.ValueOf(T{})
println(v.NumField(), v.NumMethod())
}
Choices:
Answer: 2 1
Run it on Go play.
Key point:
reflect.Value.NumMethod
method only counts exported methods for non-interface types/values.
reflect.Value.NumField
method counts both exported and unexported fields.