Online Access Free 1Z0-851 Exam Questions

Exam Code:1Z0-851
Exam Name:Java Standard Edition 6 Programmer Certified Professional Exam
Certification Provider:Oracle
Free Question Number:290
Posted:Aug 25, 2026
Rating
100%

Question 1

Given:
11.class Alpha {
12.public void foo() { System.out.print("Afoo "); }
13.}
14.public class Beta extends Alpha {
15.public void foo() { System.out.print("Bfoo "); }
16.public static void main(String[] args) {
17.Alpha a = new Beta();
18.Beta b = (Beta)a;
19.a.foo();
20.b.foo();
21.}
22.}
What is the result?

Question 2

Given:
1.package com.company.application;
2.3.
public class MainClass {
4.public static void main(String[] args) {}
5.} And MainClass exists in the /apps/com/company/application directory. Assume the CLASSPATH environment variable is set to "." (current directory).
Which two java commands entered at the command line will run MainClass? (Choose two.)

Question 3

Given:
11.class Animal { public String noise() { return "peep"; } }
12.class Dog extends Animal {
13.public String noise() { return "bark"; }
14.}
15.class Cat extends Animal {
16.public String noise() { return "meow"; }
17.} ...
30.Animal animal = new Dog();
31.Cat cat = (Cat)animal;
32.System.out.println(cat.noise()); What is the result?

Question 4

Given:
11.interface DeclareStuff {
12.public static final int EASY = 3;
13.void doStuff(int t); }
14.public class TestDeclare implements DeclareStuff {
15.public static void main(String [] args) {
16.int x = 5;
17.new TestDeclare().doStuff(++x);
18.}
19.void doStuff(int s) {
20.s += EASY + ++s;
21.System.out.println("s " + s);
22.}
23.}
What is the result?

Question 5

Given:
3.class Employee {
4.String name; double baseSalary;
5.Employee(String name, double baseSalary) {
6.this.name = name;
7.this.baseSalary = baseSalary;
8.}
9.}
10.public class SalesPerson extends Employee {
11.double commission;
12.public SalesPerson(String name, double baseSalary, double commission) {
13.// insert code here
14.}
15.}
Which two code fragments, inserted independently at line 13, will compile? (Choose two.)

Add Comments

Your email address will not be published. Required fields are marked *

insert code
Type the characters from the picture.