Scala - Error in Inheritance: <console>:: error: not found: value

0 votes

Hello , I am facing the below issue while executing the below code.

Can you please assist?

class vehicle (year:Int){

var Year = year

def cardet(name:String) {

var Name = name

println("Car name" + " " + name + " " + "Year" + " " + year)}}


class car(Speed:Int) extends vehicle(year){

var model = " " 

def printc() = { "Model " + " " + model + "Speed" + "  " + Speed + "Year" + "  " + Year}

}

<console>:8: error: not found: value year

       class car(Speed:Int) extends vehicle(year){
Aug 1 in Apache Spark by Ramya
115 views

1 answer to this question.

0 votes

You need to declare the variable which you have in the parent class in the derived class as well. Refer to the below screenshot,image

answered Aug 1 by Karan

Related Questions In Apache Spark

0 votes
1 answer

Scala: error: value unary_+ is not a member of (Int, Int)

All prefix operators' symbols are predefined: +, -, ...READ MORE

answered Jul 22 in Apache Spark by karan
58 views
0 votes
1 answer

where can i get spark-terasort.jar and not .scala file, to do spark terasort in windows.

Hi! I found 2 links on github where ...READ MORE

answered Feb 13 in Apache Spark by Omkar
• 67,600 points
118 views
0 votes
1 answer

Error: value textfile is not a member of org.apache.spark.SparkContext

Hi, Regarding this error, you just need to change ...READ MORE

answered Jul 4 in Apache Spark by Gitika
• 25,340 points
184 views
0 votes
1 answer

Error : split value is not a member of org.apache.spark.sql.Row

spark.read.csv is used when loading into a ...READ MORE

answered Jul 10 in Apache Spark by Rishi
323 views
0 votes
1 answer
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,690 points
3,063 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,690 points
341 views
0 votes
10 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
15,044 views
0 votes
1 answer

Scala: 30: error: value partitions is not a member of String

Try this code: val rdd= sc.textFile (“file.txt”, 5) rdd.partitions.size Output ...READ MORE

answered Jul 29 in Apache Spark by Nijit
39 views
0 votes
1 answer

How can I write a text file in HDFS not from an RDD, in Spark program?

Yes, you can go ahead and write ...READ MORE

answered May 29, 2018 in Apache Spark by Shubham
• 13,300 points
1,396 views