Public is not a role. You can understand it as a set of all database users.
If a permission is granted to the public, the database user can have this permission (of course, some users may not have the connect permission ).
For example, if you want to grant all users the select permission to an object t1
Grant select on user1.t1 to public;
Create public synonym t1 for t1;
All public users can access table t1.
For example
Grant dba to public;
All users have the dba permission.
See the following example.
SQL> grant dba to public;
Authorization successful.
SQL> create user hh identified by hh123 default tablespace users;
User Created
SQL> conn hh/hh123
Connected.
SQL> create table t1 (a int );
The table has been created.
SQL> conn/as sysdba
Connected.
SQL> revoke dba from public;
Withdrawing successful.
SQL> conn hh/hh123
ERROR:
ORA-01045: user FANG lacks create session privilege; logon denied
In this example, the DBA permission is granted to all users. Therefore, the created hh user has the DBA permission and can log on. Then, the DBA permission of all users is revoked, hh users cannot log on again.